2
votes

How do I keep my script running after encountering this error?

requests.exceptions.SSLError:
HTTPSConnectionPool(host='www.funcate.org.br', port=443): Max retries exceeded with url: /pt/portal-de-compras?file=../../../index.php%250A (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:718)'),))

1
Editing your question to include a Minimal, Complete, and Verifiable example will help people help you. That said, you might just need a simple try/except. - c-x-berger
...well, try/except if you don't want the untrustable content. If you want to retrieve the content anyhow, that calls for a different solution. - Charles Duffy
...also, are you really sure you want to ignore the error, as opposed to (f/e) embedding the certificate in your software so you can validate it, and thus avoiding the error without completely giving up the security that SSL is supposed to offer you? - Charles Duffy

1 Answers

4
votes

You can switch off SSL certificate verification by passing verify=False as an extra argument to the requests.get() function:

response = requests.get('https://foobar.com.br/', verify=False)

Be advised that this will make you susceptible to all sorts of man in the middle attacks. SSL certificates are used for a reason :-) Although I realize that you are not necessarily in a position to enforce this.