Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Fix #408: Support local redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
mmocny committed May 28, 2015
1 parent 7298b6a commit 4ebe6d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion web-service/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def FetchAndStoreUrl(siteInfo, url, distance=None, force_update=False):
elif result.status_code == 204: # No Content
return None
elif result.status_code in [301, 302, 303, 307, 308]: # Moved Permanently, Found, See Other, Temporary Redirect, Permanent Redirect
final_url = result.headers['location']
final_url = urljoin(url, result.headers['location'])
logging.info('FetchAndStoreUrl url:{0}, redirects_to:{1}'.format(url, final_url))
if siteInfo is not None:
logging.info('Removing Stale Cache for url:{0}'.format(url))
Expand Down
5 changes: 4 additions & 1 deletion web-service/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
'http://www.blackanddecker.fr',
'http://www.google.com',
'http://dota2.gamepedia.com/',
'http://www.orange.fr'
'http://www.orange.fr',
'http://librarian.codes',
'http://fredrikthalberg.com',
'http://harleykwyn.com',
]


Expand Down

0 comments on commit 4ebe6d5

Please sign in to comment.