Skip to content

Commit 3ad8620

Browse files
committed
Fixed error handling
On my computer it's failing on the first request to https://thepiratebay.org/ . I think the properties this code is handling need an HTTPError according to the doc https://docs.python.org/3/library/urllib.error.html\#urllib.error.URLError
1 parent 1e9b314 commit 3ad8620

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pirate/torrent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def find_api(mirror, timeout):
146146
f = request.urlopen(req, timeout=timeout)
147147
if f.info().get_content_type() == 'application/json':
148148
return mirror + path
149-
except urllib.error.URLError as e:
149+
except urllib.error.HTTPError as e:
150150
res = e.fp.read().decode()
151151
if e.code == 503 and 'cf-browser-verification' in res:
152152
raise IOError('Cloudflare protected')

0 commit comments

Comments
 (0)