It returns None on purpose, when there is no token_expiry set.
If you look at method _do_refresh_request(), line 730, you'll see that the
token_expiry is explicitly set to None when it is explicitly not returned
from the http call.

Maybe I should explicitly state this in the docstring of the method.


On Tue, Jun 3, 2014 at 11:29 AM, Craig Citro <notifications@github.com>
wrote:

> In oauth2client/client.py:
>
> > @@ -625,6 +628,18 @@ def set_store(self, store):
> >      """
> >      self.store = store
> >
> > +  def _expires_in(self):
> > +    """Return the number of seconds until this token expires."""
> > +    if self.token_expiry:
> > +      now = datetime.datetime.utcnow()
> > +      if self.token_expiry > now:
> > +        time_delta = self.token_expiry - now
> > +        # TODO(orestica): return time_delta.total_seconds()
> > +        # once dropping support for Python 2.6
> > +        return time_delta.days * 86400 + time_delta.seconds
> > +      else:
>
> Actually, this function might still return None (say if token_expiry is
> missing); how about we just drop this line and outdent the next to be what
> happens if anything falls through? (i'm shooting for a consistent return
> type here.)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/google/oauth2client/pull/15/files#r13350809>.
>



-- 
Orest Bolohan

Software Engineer
Cloud/TI Identity and Access Management Services
Google Inc.
Mountain View, CA

(650) 214 3458
orest@google.com