Skip to content

Instantly share code, notes, and snippets.

@kwinkunks
Last active April 11, 2023 13:37
Show Gist options
  • Save kwinkunks/50f11dac6ab7ff8c3e6c7b34536501a2 to your computer and use it in GitHub Desktop.
Save kwinkunks/50f11dac6ab7ff8c3e6c7b34536501a2 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kwinkunks
Copy link
Author

kwinkunks commented Apr 29, 2020

A note about proxies

If you are in a corporate environment, you probably connect to the Internet through another computer called a 'proxy'. You will need the URL of this proxy; it might look like https://proxy.my-company.net:8080. Then use it in your Python environment like this:

proxies  = {'https': 'https://proxy.my-company.net:8080'}
r = requests.get(url, proxies=proxies)

Each time you use requests.get() you will need to pass the proxies dictionary in this way.

Getting SSLCertVerificationError or similar

If you get some variant of SSLError, SSLCertVerificationError, CERTIFICATE_VERIFY_FAILED or certificate verify failed: unable to get local issuer certificate, then you need to tell requests where to find your certificates. On Linux, they are usually in /etc/ssl/certs. For example, this sort of thing might work:

verify = '/etc/ssl/certs/ca-bundle.crt'
r = requests.get(url, verify=verify)

On Windows you need to export your CA certs from your registry to a file and point requests to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment