We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

mhnakhuda's avatar
mhnakhuda
New member | Level 2
5 years ago

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

Hi everyone,

I am getting the following error: 

C:\Python36\Dartfish\Scripts\python.exe C:/Workspace/COC-Dartfish/Dartfish/Dropbox_Download.py SBL

Traceback (most recent call last):
  File "C:\Python36\Dartfish\lib\site-packages\urllib3\connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "C:\Python36\Dartfish\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "C:\Python36\Dartfish\lib\site-packages\urllib3\connectionpool.py", line 976, in _validate_conn
    conn.connect()
  File "C:\Python36\Dartfish\lib\site-packages\urllib3\connection.py", line 370, in connect
    ssl_context=context,
  File "C:\Python36\Dartfish\lib\site-packages\urllib3\util\ssl_.py", line 377, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Program Files\Python36\lib\ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "C:\Program Files\Python36\lib\ssl.py", line 817, in __init__
    self.do_handshake()
  File "C:\Program Files\Python36\lib\ssl.py", line 1077, in do_handshake
    self._sslobj.do_handshake()
  File "C:\Program Files\Python36\lib\ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python36\Dartfish\lib\site-packages\requests\adapters.py", line 449, in send
    timeout=timeout
  File "C:\Python36\Dartfish\lib\site-packages\urllib3\connectionpool.py", line 725, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "C:\Python36\Dartfish\lib\site-packages\urllib3\util\retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='content.dropboxapi.com', port=443): Max retries exceeded with url: /2/files/download (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Workspace/COC-Dartfish/Dartfish/Dropbox_Download.py", line 95, in <module>
    dd = DropBoxDownload(args.sportscode)
  File "C:/Workspace/COC-Dartfish/Dartfish/Dropbox_Download.py", line 39, in __init__
    self.process_entries()
  File "C:/Workspace/COC-Dartfish/Dartfish/Dropbox_Download.py", line 84, in process_entries
    dbx.files_download_to_file(local_file, entry.path_lower)
  File "C:\Python36\Dartfish\lib\site-packages\dropbox\base.py", line 1238, in files_download_to_file
    None,
  File "C:\Python36\Dartfish\lib\site-packages\dropbox\dropbox.py", line 274, in request
    timeout=timeout)
  File "C:\Python36\Dartfish\lib\site-packages\dropbox\dropbox.py", line 365, in request_json_string_with_retry
    timeout=timeout)
  File "C:\Python36\Dartfish\lib\site-packages\dropbox\dropbox.py", line 449, in request_json_string
    timeout=timeout,
  File "C:\Python36\Dartfish\lib\site-packages\requests\sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "C:\Python36\Dartfish\lib\site-packages\requests\sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python36\Dartfish\lib\site-packages\requests\sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python36\Dartfish\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='content.dropboxapi.com', port=443): Max retries exceeded with url: /2/files/download (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))

Process finished with exit code 1

 

To give you context, I am using a python library to download some files, this seemed to be working however I am not sure when it stopped working. However, I just tried this program on my windows 10 machine, and also a spare Linux machine with the same error. 

I have tried the different solutions provided, but none of them seemed to have worked. If someone can help me out, that'd be really awesome. Appreciate your help. 


Running:

dropbox 10.2.0
Python 3

  • Greg-DB's avatar
    Greg-DB
    5 years ago

    That shouldn't be the issue here. The files_download_to_file method does allow you to download files from shared folders. Also, the error you're getting indicates an issue establishing the secure TLS connection with the Dropbox API servers, which occurs before the Dropbox API itself validates the call or its parameters anyway.

    • mhnakhuda's avatar
      mhnakhuda
      New member | Level 2

      For context here's the code I am running

      dbx = dropbox.Dropbox("MY TOKEN!!")
      result = dbx.files_list_folder("", recursive=True)
      while result.has_more:
      result = dbx.files_list_folder_continue(result.cursor)
      for entry in result.entries:
      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        I see from the stack trace that this error is occurring during files_download_to_file. I just gave that, as well as the other methods you included in the code snippet, a try with Python 3.6 and v10.2.0 of the Dropbox Python library on Windows though and it worked fine for me.

         

        The error you're getting would seem to indicate that the Dropbox API servers aren't being served with a valid certificate, however that is not the case.

         

        Is there anything on your network connection, e.g., a proxy, firewall, anti-virus, or other such software that may be interfering with your connection to the Dropbox API servers? For the files_download_to_file method in particular, it would be to the content.dropboxapi.com host.