forked from MirrorHub/synapse
As of version 2.7.9, urllib2 now checks SSL certs
This commit is contained in:
parent
0575840866
commit
16dcdedc8a
1 changed files with 6 additions and 1 deletions
|
@ -49,7 +49,12 @@ def request_registration(user, password, server_location, shared_secret):
|
|||
headers={'Content-Type': 'application/json'}
|
||||
)
|
||||
try:
|
||||
f = urllib2.urlopen(req)
|
||||
if sys.version_info[:3] >= (2, 7, 9):
|
||||
# As of version 2.7.9, urllib2 now checks SSL certs
|
||||
import ssl
|
||||
f = urllib2.urlopen(req, ctx=ssl.SSLContext(ssl.PROTOCOL_SSLv23))
|
||||
else:
|
||||
f = urllib2.urlopen(req)
|
||||
f.read()
|
||||
f.close()
|
||||
print "Success."
|
||||
|
|
Loading…
Reference in a new issue