def token(self, value): _token = value if _token and _token.get("expires_in"): # Set the `expires_at` value, overwriting any value # that may already be there. delta = timedelta(seconds=_token["expires_in"]) expires_at = datetime.utcnow() + delta _token["expires_at"] = timestamp_from_datetime(expires_at) self.backend.set(self, _token) lazy.invalidate(self.session, "token")
def token(self, value): _token = value if _token and _token.get("expires_in"): # Set the `expires_at` value, overwriting any value # that may already be there. delta = timedelta(seconds=_token["expires_in"]) expires_at = datetime.utcnow() + delta _token["expires_at"] = timestamp_from_datetime(expires_at) self.backend.set(self, _token) lazy.invalidate(self.session, "token")
def token(self, value): _token = value if _token and _token.get("expires_in"): # Set the `expires_at` value, overwriting any value # that may already be there. delta = timedelta(seconds=_token["expires_in"]) expires_at = datetime.utcnow() + delta _token["expires_at"] = timestamp_from_datetime(expires_at) self.storage.set(self, _token) try: invalidate_cached_property(self.session, "token") except KeyError: pass