Forums

OpenSSL.SSL.Error: [('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')]

I am using the python requests library to connect to our wordpress server API. THe script runs just fine on my local machine, but as soon as I try run on pythonanywhere I get this ssl error?

OpenSSL.SSL.Error: [('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')]

Does anyone have a suggestion on what I am doing wrong and how to fix this, as I do not particualrly want to run the bypasss SSL verification.

If the same code works locally and is not working on PythonAnywhere it usually means that the requests from PA are being blocked by the server (then there's nothing we can do about it). If want us to check it, we'd need the endpoint that you're hitting (you may send it via email at support@pythonanywhere.com).

Thanks, if I pass the verify=none parameter using the python requests libdary it works fine on PA.

My script also queries two different servers/services and both fail ssl validation on PA, but work if you bypass ssl. Both work find my my local machine.

Does this still mean it's being blocked

I believe we already answered you via email. The reason is most probably that you're on an old system image, upgrading it should solve the issue, see: https://help.pythonanywhere.com/pages/ChangingSystemImage/.

Hi, yes that was exactly the issue.. I was using an ancient image.. updated to something up-to-date and its all perfect now. thanks for the help. :-)

Excellent, thanks for confirming this!

I also updated my system image and still have the issue, what else could be causing this?

Where are you running your code?