Add additional docstring for the OAuth2Credentials._expires_in() method,
explaining what values are returned when token_expiry is in the past or None.
This commit is contained in:
@@ -629,7 +629,14 @@ class OAuth2Credentials(Credentials):
|
||||
self.store = store
|
||||
|
||||
def _expires_in(self):
|
||||
"""Return the number of seconds until this token expires."""
|
||||
"""Return the number of seconds until this token expires.
|
||||
|
||||
If token_expiry is in the past, this method will return 0, meaning the
|
||||
token has already expired.
|
||||
If token_expiry is None, this method will return None. Note that returning
|
||||
0 in such a case would not be fair: the token may still be valid;
|
||||
we just don't know anything about it.
|
||||
"""
|
||||
if self.token_expiry:
|
||||
now = datetime.datetime.utcnow()
|
||||
if self.token_expiry > now:
|
||||
|
||||
Reference in New Issue
Block a user