Use head instead of get for URL expansion

This commit is contained in:
Jose Manuel Delicado 2017-09-18 10:38:20 +02:00
parent 59504cca57
commit a1381008d7

View File

@ -20,4 +20,8 @@ class URLShortener (object):
raise NotImplementedError
def unshorten(self, url):
return url
try:
r=requests.head(url, allow_redirects=True)
return r.url
except:
return url #we cannot expand