[Tutor] http through squid
Marco A. Sousa
marcolinux@linuxbr.com.br
Wed, 22 May 2002 12:33:07 -0300
>
> I am trying to do a URL request from behind a firewall. If I understand
> it correctly (and I'll use generic symbols here) the proxy server is
> x.y.z at port 123. The Squid proxy-caching software is running. I can
[SNIP]
>
> Does anyone have a working script that works in a similar squid/proxy
> configuration?
>
You can try put some environment variables telling about your proxy.
It worked for me (linux, python 2.1):
import urllib,os
os.putenv ('http_proxy','10.15.50.3:3128')
dic={'name':'python','email':'python@python.net'}
url = urllib.urlopen('http://somesite.net/',urllib.urlencode(dic))
Also take a look at this page:
http://www.python.org/doc/lib/module-urllib.html
Hope that helps.