From 11ca3a219069985ca88f7228158f44e2fa4d1abc Mon Sep 17 00:00:00 2001 From: Jose Manuel Delicado Date: Fri, 22 Sep 2017 17:18:38 +0200 Subject: [PATCH] URL shortener now performs step by step expansion, so you possibly will have to expand an URL multiple times to reach the final destination --- src/url_shortener/shorteners/url_shortener.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/url_shortener/shorteners/url_shortener.py b/src/url_shortener/shorteners/url_shortener.py index f825af0f..3335b1eb 100644 --- a/src/url_shortener/shorteners/url_shortener.py +++ b/src/url_shortener/shorteners/url_shortener.py @@ -21,7 +21,7 @@ class URLShortener (object): def unshorten(self, url): try: - r=requests.head(url, allow_redirects=True) - return r.url + r=requests.head(url) + return r.headers['location'] except: return url #we cannot expand