Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSLError (SSLCertVerificationError) when using gdown from some machines #86

Closed
khyox opened this issue Jan 3, 2021 · 1 comment · Fixed by #114
Closed

SSLError (SSLCertVerificationError) when using gdown from some machines #86

khyox opened this issue Jan 3, 2021 · 1 comment · Fixed by #114
Labels
feature for pr

Comments

@khyox
Copy link
Contributor

khyox commented Jan 3, 2021

When using gdown to try to download a file with file id _gdrive_long_file_id_ being a real file id:

$ gdown --id _gdrive_long_file_id_ 

I get the next error when doing so from some servers (it works from other machines):

Traceback (most recent call last):
  File "/.../py3.8.2/bin/gdown", line 11, in <module>
    load_entry_point('gdown', 'console_scripts', 'gdown')()
  File "/.../gdown/gdown/cli.py", line 104, in main
    download(
  File "/.../gdown/gdown/download.py", line 115, in download
    res = sess.get(url, stream=True, verify=verify)
  File "/.../python3.8/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/.../python3.8/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/.../python3.8/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/.../python3.8/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='drive.google.com', port=443):
Max retries exceeded with url: /uc?id=_gdrive_long_file_id_ (Caused by 
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)')))

This seems a known problem (e.g., see this issue) with the verification by Requests of the server's TLS certificate. A solution to this issue is to provide the users of gdown with a way to control Requests' verify parameter (it defaults to True, but see details in the API docs). I will link a PR for this solution to be considered and merged. Thanks.

@khyox
Copy link
Contributor Author

khyox commented Jan 4, 2021

With the changes in the PR, now:

$ gdown --id _gdrive_long_file_id_ --no-verify

is finally working (with some previous relevant warnings by InsecureRequestWarning):

  warnings.warn(
/.../python3.8/site-packages/urllib3/connectionpool.py:997: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
Downloading...
From: https://drive.google.com/uc?id=_gdrive_long_file_id_
To: /.../_gdrive_long_file_
673MB [27:38, 406kB/s] 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature for pr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants