mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
If an URL shortener does not redirect using head method, call get with allow_redirects set to False instead when expanding. Fixes #179
This commit is contained in:
parent
b184bed1a8
commit
6ba1fe9eac
@ -27,6 +27,9 @@ class URLShortener (object):
|
||||
return handle_dropbox(r.headers['location'])
|
||||
else:
|
||||
return r.headers['location']
|
||||
else: # if the head method does not work, use get instead. Performance may decrease
|
||||
r=requests.get(url, allow_redirects=False)
|
||||
return r.headers['location']
|
||||
except:
|
||||
return url #we cannot expand
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user