@@ -20,9 +20,9 @@ class BaseClient:
2020 _client : str = ""
2121 _secret : str = ""
2222
23- token : Optional [str ] = None
23+ _token : Optional [str ] = None
2424 """Current authentication token"""
25- token_expires : Optional [datetime ] = None
25+ _token_expires : Optional [datetime ] = None
2626 """Deadline after which token is no longer useable"""
2727
2828 grace_period : timedelta = timedelta (seconds = 10 )
@@ -80,13 +80,13 @@ async def _get_token(self):
8080 self .log .warning (f"Could not authenticate, { response ['error' ]} " )
8181 raise AuthenticationError
8282
83- self .token = response ['access_token' ]
84- self .token_expires = (datetime .now ()
83+ self ._token = response ['access_token' ]
84+ self ._token_expires = (datetime .now ()
8585 + timedelta (seconds = response ['expires_in' ]))
8686
8787 async def _verify_token (self ):
88- if (self .token is None
89- or self .token_expires < (datetime .now () - self .grace_period )):
88+ if (self ._token is None
89+ or self ._token_expires < (datetime .now () - self .grace_period )):
9090 retry = self .retry_strategy .make ()
9191 first = True
9292 while first or await retry .should_retry ():
@@ -113,7 +113,7 @@ async def http_post(self, url: str, data: Any = None,
113113 await self ._verify_token ()
114114
115115 headers = {
116- 'Authorization' : f'Bearer { self .token } ' ,
116+ 'Authorization' : f'Bearer { self ._token } ' ,
117117 'Content-Type' : 'application/json'
118118 }
119119 if params is None :
@@ -160,7 +160,7 @@ async def http_get(self, url: str, params: Optional[dict] = None) -> httpx.Respo
160160 await self ._verify_token ()
161161
162162 headers = {
163- 'Authorization' : f'Bearer { self .token } ' ,
163+ 'Authorization' : f'Bearer { self ._token } ' ,
164164 'Content-Type' : 'application/json'
165165 }
166166 if params is None :
0 commit comments