2

I'm getting the following error while using request package in Python.

'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)

I'm trying to access a link using the following code:

content = requests.get(link, verify=True, headers={"User-Agent": "Mozilla/5.0 (X11; CrOS x86_64 12871.102.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36"})
    

I searched for some solutions and found a few that talked about Install Certificate.command, but I can't find the file in my Python directory. I'm using Python 3.8. Any suggestion on how to get this resolved?

1 Answer 1

2

I had to provide the certificate to prevent this error from occuring.

cert = requests.certs.where()
        page = requests.get(link, 
                            verify=cert, 
                            headers={"User-Agent": "Mozilla/5.0 (X11; CrOS x86_64 12871.102.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36"})

This worked for me

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.