I am writing a short python script for fun to check a few pages for the amount of likes. I am using the python requests module. As seen below, there was a problem, something about certificates. I am fairly new to programming involving the web, so it’s not obvious to me what I should do. r = requests.get("http://www.google.com/") correctly returned something.
Traceback (most recent call last):
r = requests.get(“https://graph.facebook.com/cocacola“)
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Thanks!
That error looks like it is coming from OpenSSL. You might have some configuration in your environment that is causing Requests to set the certificate location to something that doesn’t contain the certificate you need.
Try investigating the possible ways that Requests might be checking for certificates:
REQUESTS_CA_BUNDLEenvironment variable.CURL_CA_BUNDLEenvironment variable.certifipackage can be imported.Check to see if one of
REQUESTS_CA_BUNDLEorCURL_CA_BUNDLEare in your environment:If one of those are set, Requests is probably using that configuration when verifying certificates. If not then Requests is probably using
certifi. In that case maybe it’s worth updating it:Failing that, try passing
verify=Falsetorequests.getto have it skip the verification step. I would recommend solving the real problem instead of just switching it off, but that might help you get to the bottom of it.