mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-02 09:49:36 +01:00
Handle login expiration
This commit is contained in:
@@ -155,6 +155,11 @@ class GazelleAPI(object):
|
|||||||
params['auth'] = self.authkey
|
params['auth'] = self.authkey
|
||||||
params.update(kwargs)
|
params.update(kwargs)
|
||||||
r = self.session.get(url, params=params, allow_redirects=False, timeout=self.default_timeout)
|
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())
|
self.past_request_timestamps.append(time.time())
|
||||||
return r.content
|
return r.content
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user