I am trying to get a cookie (and rest of the page) from a web site with cookie verification using requests library, but it fails on SSL certificate verification:
HTTPSConnectionPool(host='***host***', port=443): Max retries exceeded with url: ***url*** (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')))
I can bypass it using verify=False
, but that is unsecure. I can parse certificates but this is overkill. pip install certifi
is not doing anything. How do I fix this?
My code:
import requestsheaders = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'}r = requests.get('https://secure.ulrichsw.cz/estrava/, headers=headers, verify=True)session_id = r.cookies['PHPSESSID']print(session_id)