I'm making a request to a site which requires SSL cert to access. When I tried to access the URL, I get SSL Certificate error
import requests
proxies = {"https":"https://user:pwd@host:port"}
r = requests.get("https://URL", proxies=proxies)
print(r.status_code)
File "C:\Program Files\Python37-32\lib\site-packages\requests\sessions.py", line 533, in requestresp = self.send(prep, **send_kwargs)File "C:\Program Files\Python37-32\lib\site-packages\requests\sessions.py", line 646, in sendr = adapter.send(request, **kwargs)File "C:\Program Files\Python37-32\lib\site-packages\requests\adapters.py", line 514, in sendraise SSLError(e, request=request)requests.exceptions.SSLError: HTTPSConnectionPool(host='pit-wvrpnpd.johnlewis.co.uk', port=443): Max retries exceeded with url: /suite-api (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))
If I use verify=False in Python's Requests, I'm getting below error
r = requests.get("https://URL", proxies=proxies,verify=False)
C:\Program Files\Python37-32\lib\site-packages\urllib3\connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warningsInsecureRequestWarning)403
So I decided to download the SSL certificate from Chrome "site.cer" Then I used it as below, yet it throws error
r = requests.get("https://URL", proxies=proxies, cert=('C:\\site.cer'))
File "C:\Program Files\Python37-32\lib\site-packages\requests\sessions.py", line 533, in requestresp = self.send(prep, **send_kwargs)File "C:\Program Files\Python37-32\lib\site-packages\requests\sessions.py", line 646, in sendr = adapter.send(request, **kwargs)File "C:\Program Files\Python37-32\lib\site-packages\requests\adapters.py", line 514, in sendraise SSLError(e, request=request)requests.exceptions.SSLError: HTTPSConnectionPool(host='pit-wvrpnpd.johnlewis.co.uk', port=443): Max retries exceeded with url: /suite-api (Caused by SSLError(SSLError(9, '[SSL] PEM lib (_ssl.c:3854)')))
I'm using Python 3.7, any Idea where I made a mistake?