I have this simple snippet of code which is getting json data from jsonbin.io
import json
import requests
url = '\<URL HERE\>'
headers = {
'X-Master-Key': '\<MASTER KEY\>'
}
req = requests.get(url, json=None, headers=headers)
print(req.text)
data = json.loads(req.text)
print(data)
This exact snippet of code has worked before, (a few hours prior) and I have not made any changes to my code. However now I am receiving this error:
Exception has occurred: SSLError
HTTPSConnectionPool(host='api.jsonbin.io', port=443): Max retries exceeded with url: \<URL HERE\> (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)')))
I have tried running the same snippet of code on my other work station and my other laptop they both worked.
- I have tried uninstalling python and all the pip packages, cleared pip cache and reinstalled it.
- I have tried this approach where I got the pem file and did
r = requests.post(url, data=data, verify='/path/to/public_key.pem')
- I have updated certifi
- I have followed the guidance of this post's accepted answer
- setting verify=False works but I do not think it is advisable to do so
Is it possible that it is due to my laptop's certificates? I am still a newbie with this so any advice is highly appreciated!