Requests Behind Corporate Proxies in Python/v3

How to configure Plotly's Python API to work with corporate proxies


Note: this page is part of the documentation for version 3 of Plotly.py, which is not the most recent version.
See our Version 4 Migration Guide for information about how to upgrade.
The version 4 version of this page is here.

Using Plotly's Python API Behind a Corporate Proxy

If you are behind a corporate firewall, you may see the error message:

requests.exceptions.ConnectionError: ('Connection aborted.', TimeoutError(10060, ...)
Click to copy

Plotly uses the requests module to communicate with the Plotly server. You can configure proxies by setting the environment variables HTTP_PROXY and HTTPS_PROXY.

$ export HTTP_PROXY="http://10.10.1.10:3128"
$ export HTTPS_PROXY="http://10.10.1.10:1080"
Click to copy

To use HTTP Basic Auth with your proxy, use the http://user:password@host/ syntax:

$ export HTTP_PROXY="http://user:pass@10.10.1.10:3128/"
Click to copy

Note that proxy URLs must include the scheme.

You may also see this error if your proxy variable is set but you are no longer behind the corporate proxy. Check if a proxy variable is set with:

$ echo $HTTP_PROXY
$ echo $HTTPS_PROXY
Click to copy

Still not working?