def refresh_auth_tokens_from_cache(self):
"""Refresh the auth token and other values from cache"""
if self.authToken is not None and time() + MAX_BUFFER < self.authTokenExpiration:
# no need to refresh if the current tokens are still good
return
tokens = cache.get(self.token_cache_key)
if tokens:
if not isinstance(tokens, dict):
# something wrong was cached
cache.delete(self.token_cache_key)
return
for prop, value in tokens.items():
if prop in self.token_property_names:
setattr(self, prop, value)
# set the value so we can detect if it changed later
self._old_authToken = self.authToken
self.build_soap_client()
评论列表
文章目录