[Tutor] Httplib and Proxy

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sun Jan 27 04:33:33 EST 2002


On Sat, 26 Jan 2002, A wrote:

> Can anybody please give me a working example how I can use 
> httplib with a proxy if I use POST method?

urllib.urlopen() may be what you're looking for:

    http://www.python.org/doc/current/lib/module-urllib.html


If you're using an HTTP proxy, you can first set the 'http_proxy'
environmental variable, and then urllib.urlopen() will use that when it
retrieves http resources.  urlllib.urlopen() also supports POST if we send
the data as a second parameter to urlopen().

Good luck!





More information about the Python-list mailing list