Using Jupyter behind a proxy

tog picture tog · Apr 14, 2016 · Viewed 29.2k times · Source

Is there a similar config to that of .condarc (anaconda 4.0.0) that allows Jupyter to be configured to work behind a corporate proxy on a local machine?

Error received:

HTTPError: HTTP Error 407: Proxy Authentication Required

Answer

Boern picture Boern · May 8, 2017

Way easier: Just add the following to your notebook:

In [1]: import os
        os.environ['http_proxy'] = "http://user:passwd@host:port" 
        os.environ['https_proxy'] = "https://user:passwd@host:port" 

after that, requests will work OK=200, e.g.

In [2]: import requests
        requests.get("https://google.com")
Out[2]: <Response [200]>