dealing with a proxy

Ulf Engström ulf.engstrom at b2b-link.com
Mon Mar 6 16:21:37 CET 2000


Steven Adams:
h = httplib.HTTP(proxyhost,proxyport)
h.putrequest('GET','http://somewhere.somedomain')

David Fisher:
> urllib has proxy support built-in, but not documented
proxy = {'http':r'http://192.168.1.1:3128'}

Me:
Don't know exxactly for which modules it actually works, but setting the proxy in os.environ is a way with some of the modules I've used at least.
>>> import os
>>> os.environ['http_proxy'] = 'http://Inetserver' #This is the name of our proxy, running on port 80
>>> import urllib
>>> page = urllib.urlopen('http://www.python.org')
>>> print page.read()
<HTML>
<!-- THIS PAGE IS AUTOMATICALLY GENERATED.  DO NOT EDIT. -->
<!-- Fri Mar  3 10:31:14 2000 -->
etc.

Regards
Ulf Engström
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20000306/fecaf210/attachment.html>


More information about the Python-list mailing list