8000 Update getisbn to allow TLSv1 · waldemar-becker/python-stdnum@5071636 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Mar 4, 2019. It is now read-only.

Commit 5071636

Browse files
committed
Update getisbn to allow TLSv1
The www.isbn-international.org site uses TLSv1 which seems to be blocked by recent Python/OpenSSL combinations unless configured otherwise.
1 parent edaad05 commit 5071636

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

getisbn.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
an item number and a check-digit."""
2727

2828
from xml.etree import ElementTree
29+
import ssl
2930
import urllib.request
3031

3132

@@ -55,7 +56,8 @@ def get(f=None):
5556
if f is None:
5657
yield '# generated from RangeMessage.xml, downloaded from'
5758
yield '# %s' % download_url
58-
f = urllib.request.urlopen(download_url)
59+
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
60+
f = urllib.request.urlopen(download_url, context=ctx)
5961
else:
6062
yield '# generated from %r' % f
6163

0 commit comments

Comments
 (0)
0