How to configure HTTP/HTTPS proxy for iPython notebook server

Just to clarify, this is not a post on how to configure apache/nginx to proxy requests to iPython notebook server or a backend proxy.

This is when you have a iPython notebook server running on your laptop/desktop behind a corporate/school proxy/firewall and any web requests needs to go through such proxy. On bash shell you just export the env variable like this and its taken care off. However for a iPython server the env variables are not inherited from user bash profile.

You have to modify the iPython notebook server env. Create a file named under your .ipython notebook server profile and add the following:

For example:

vi /.ipython/profile_myserver/startup/

and add

import sys,os,os.path

you confirm the env variables by running

%env in a cell and the output

{'CLICOLOR': '1',
 'GIT_PAGER': 'cat',
 'HOME': '/home/jay',
 'HTTP_PROXY': '',

Next try

import requests

If you get a response [200] then you are all set.

Leave a Reply