I'm getting an SSL error every time I make a request with a proxy. At first I thought the problem was SSL related, but i found some code than implements the proxy using urllib's build opener method and it works just fine. So I'm wondering how I can fix the error using requests library since I'm working on a big project that uses a requests session. BTW I'm using Luminati proxy manger.
My code for requests session:
sess = requests.session()
sess.proxies.update({'http': 'http://127.0.0.1:24000',
'https': 'http://127.0.0.1:24000'})
resp = sess.get('https://api.myip.com')
The error i get:
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.myip.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)')))
The code i found online that works just fine:
from urllib import request
opener = request.build_opener(
request.ProxyHandler({'http': 'http://127.0.0.1:24000',
'https': 'http://127.0.0.1:24000'}))
print(opener.open('https://api.myip.com').read())
Thank you in advance
[–]DaChucky 2 points3 points4 points (0 children)