Handle login expiration

This commit is contained in:
cohena
2014-03-30 13:07:38 -07:00
parent dbe644aee2
commit ca8ab32eaf

View File

@@ -155,6 +155,11 @@ class GazelleAPI(object):
params['auth'] = self.authkey
params.update(kwargs)
r = self.session.get(url, params=params, allow_redirects=False, timeout=self.default_timeout)
if r.status_code == 302 and r.raw.headers['location'] == 'login.php':
self.logged_in_user = None
raise LoginException("User login expired")
self.past_request_timestamps.append(time.time())
return r.content