Reputation: 327
I get the error in the title
I have python 2.7.14 and OpenSSL 1.0.2k 26 Jan 2017
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) #Itried all the other protocols
ctx.check_hostname = False #fails with or without these 2 lines
ctx.verify_mode = ssl.CERT_NONE
resp = urllib2.urlopen(url, context=ctx).read()
Update: This is the url (sensitive data replaced with ..) https://www.upwork.com/api/hr/v2/teams/../users.json?oauth_consumer_key=..&oauth_nonce=..&oauth_signature_method=HMAC-SHA1&oauth_timestamp=..&oauth_token=..&oauth_version=1.0&tz=gmt&oauth_signature=..
All keys and tokens work because I also use them on a javscript platform and they work perfectly there. Also simply pasting the link in browser works. But in python I have no idea how to debug this. Anyone can please help ? Thank you, deeply appreciated
Upvotes: 2
Views: 3793
Reputation: 123270
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) #Itried all the other protocols
There is no ssl.PROTOCOL_TLS
. There are for example ssl.PROTOCOL_TLSv1
which does not work and there is ssl.PROTOCOL_TLSv1_2
which does work for me. Even better use ssl.create_default_context()
.
Upvotes: 4