Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/cygwin-apps/calm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2022-11-21 00:24:34 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2022-11-21 00:29:23 +0300
commitfc50fe36f4834273b0063caada2aeea6cf200672 (patch)
treeae2b7ea979667154b85db90d9450e5a1c2e7f958
parent175aeb644de5e9271394d56176ba2de8cec2f082 (diff)
Avoid an exception when homepage: isn't a URL
urllib.request.Request() throws a ValueError when the URL doesn't start with a scheme. e.g. is just a hostname.
-rw-r--r--calm/fixes.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/calm/fixes.py b/calm/fixes.py
index f147be2..1f67d13 100644
--- a/calm/fixes.py
+++ b/calm/fixes.py
@@ -98,8 +98,8 @@ class NoRedirection(urllib.request.HTTPErrorProcessor):
def follow_redirect(homepage):
opener = urllib.request.build_opener(NoRedirection)
opener.addheaders = [('User-Agent', 'calm')]
- request = urllib.request.Request(homepage, method='HEAD')
try:
+ request = urllib.request.Request(homepage, method='HEAD')
response = opener.open(request, timeout=60)
if response.code in [301, 308]:
return response.headers['Location']