mirror of
https://github.com/instaloader/instaloader.git
synced 2024-09-11 16:22:24 +02:00
handle alternate rate limit exceeded behavior of redirecting to login
This commit is contained in:
parent
4e8236b6e9
commit
20819d2597
@ -358,6 +358,9 @@ class InstaloaderContext:
|
||||
while resp.is_redirect:
|
||||
redirect_url = resp.headers['location']
|
||||
self.log('\nHTTP redirect from https://{0}/{1} to {2}'.format(host, path, redirect_url))
|
||||
if redirect_url.startswith('https://www.instagram.com/accounts/login'):
|
||||
# alternate rate limit exceeded behavior
|
||||
raise TooManyRequestsException("429 Too Many Requests: redirected to login")
|
||||
if redirect_url.startswith('https://{}/'.format(host)):
|
||||
resp = sess.get(redirect_url if redirect_url.endswith('/') else redirect_url + '/',
|
||||
params=params, allow_redirects=False)
|
||||
|
Loading…
Reference in New Issue
Block a user