From 95830b0a52be1e64d60b331e917b0e8618a559a9 Mon Sep 17 00:00:00 2001 From: Orest Bolohan Date: Tue, 3 Jun 2014 15:36:17 -0700 Subject: [PATCH] Add additional docstring for the OAuth2Credentials._expires_in() method, explaining what values are returned when token_expiry is in the past or None. --- oauth2client/client.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/oauth2client/client.py b/oauth2client/client.py index 575fa49..a3af4f8 100644 --- a/oauth2client/client.py +++ b/oauth2client/client.py @@ -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: