[Nottingham] Python behind proxy

Andy White andy at milky.org.uk
Wed Dec 19 06:25:26 UTC 2012


> I am behind a corporate proxy at present and I find that scripts using
> python time out, for example
> sudo add-apt-repository ppa:voria/ppa

sudo env http_proxy=http://my.proxy:80/ add-apt-repository ppa:voria/ppa

> sudo python -c "import sys; py3 = sys.version_info[0] > 2; u =
> __import__('urllib.request' if py3 else 'urllib', fromlist=1);
> exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read());
> main()"

sudo env http_proxy=http://my.proxy:80/  python -c "import sys; py3 = sys.version_info[0] > 2; u = ....'

fairly sure both of those will read the environment variable http_proxy

More information about the Nottingham mailing list