Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL error : routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Tags:

python

file

ssl

I have a large number of file download links in a txt file. I am trying to write a python script to download all the files at once, but I end up with the following error:

SSLError: [Errno 1] _ssl.c:499: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed 

The file is being downloaded via intranet.

I tried to download the file via browser and I got a pop up with some certificate. I tried to google it but didn't find a way to solve this.

like image 276
Sangamesh Avatar asked Jun 13 '13 10:06

Sangamesh


3 Answers

The server certificate is invalid, either because it is signed by an invalid CA (internal CA, self signed,...), doesn't match the server's name or because it is expired.

Either way, you need to find how to tell to the Python library that you are using that it must not stop at an invalid certificate if you really want to download files from this server.

like image 122
Remi Gacogne Avatar answered Oct 05 '22 23:10

Remi Gacogne


Experienced this myself when using requests:

This is extremely insecure; use only as a last resort! (See rdlowrey's comment.)

requests.get('https://github.com', verify=True)

Making that verify=False did the trick for me.

like image 26
Stevenm Avatar answered Oct 05 '22 21:10

Stevenm


Got this issue today and after wandering for several hours just came to know that my server datetime was wrong.

So first please check your server datetime before going so deep in this issue.

also try doing

>> sudo update-ca-certificates
like image 17
Hemant_Negi Avatar answered Oct 05 '22 23:10

Hemant_Negi