requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

24,318

Solution 1

You need to download the GoDaddy root certificates, available at this site and then pass it in as a parameter to verify, like this:

>>> r = requests.get('https://aucoe.info', verify='/path/to/gd_bundle-g2-g1.crt')
>>> r.status_code
200

If you'll be doing multiple requests, you may want to configure the SSL as part of the session, as highlighted in the documentation.

Solution 2

You can always set verify= False. Easy way, not the best.

Share:
24,318
Om Prakash
Author by

Om Prakash

Data Scientist / Backend Developer If I helped you with Machine Learning/Natural Language Processing/Pandas or any other technology would you please visit LinkedIn and endorse me? Thank you!

Updated on July 09, 2022

Comments

  • Om Prakash
    Om Prakash almost 2 years

    This is not a duplicate of this question

    I checked this but going insecure way doesn't looks good to me.

    I am working on image size fetcher in python, which would fetch size of image on a web page. Before doing that I need to get web page status-code. I tried doing this way

    import requests
    
    hdrs = {'User-Agent': 'Mozilla / 5.0 (X11 Linux x86_64) AppleWebKit / 537.36 (KHTML, like Gecko) Chrome / 52.0.2743.116 Safari / 537.36'}
    
    
    urlResponse = requests.get(
        'http://aucoe.info/', verify=True, headers=hdrs)
    print(urlResponse.status_code)
    

    This gives error:

    ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

    I tried changing verify=True to

    verify='/etc/ssl/certs/ca-certificates.crt'

    and

    verify='/etc/ssl/certs'

    But it still gives the same error. I need to get status code for more than 5000 urls. Kindly help me. Thanks in advance.

    Python Version : 3.4

    Requests version : requests==2.11.1

    O.S : Ubuntu 14.04

    pyOpenSSL : 0.13

    openssl version : OpenSSL 1.0.1f 6 Jan 2014

  • EngineerAkki
    EngineerAkki over 3 years
    Why godaddy ? Is the domain registered with godaddy ?