Python Behind a Squid Corporate Proxy on Windows

Danilo coragi at gmail.com
Thu Aug 21 15:00:28 EDT 2008


Hi,

do you manage to go through the proxy? I'm having the same problem
with error 407. I've tried many solutions from the web but it always
show the same error. So, if you solved your problem, please, post it
here.

Thanks
Danilo

On 18 jul, 15:43, Larry Hale <larz... at hotmail.com> wrote:
> Thank you so much for the reply, but alas: I get the same results.
> (urllib2 makes the initial request,Squidreplies "Error 407:Proxy
> Authentication Required", which urllib2 dutifully fails on/raises said
> error...)
>
> I do appreciate your time, though!  :)
> -Larry
>
> On Jul 18, 3:08 am, Chris <cwi... at gmail.com> wrote:
>
> > On Jul 17, 6:40 pm, Larry Hale <larz... at hotmail.com> wrote:
>
> > > Err, the line above should be:
>
> > > proxy_handler = urllib2.ProxyHandler( { "http": "http://
> > > myusername:passw... at webfilter.xyz.local:3128" } )
>
> > > (Sorry!  :)
>
> > some old code I wrote to download public domain info for our company,
> > also through asquidproxyand this still works for me
>
> > import urllib2, urllib
>
> >proxy= urllib2.ProxyHandler({'http': 'http://
> > username:password at proxy_url:proxy_port'})
> > auth = urllib2.HTTPBasicAuthHandler()
> > opener = urllib2.build_opener(proxy, auth, urllib2.HTTPHandler)
> > urllib2.install_opener(opener)
>
> > conn = urllib2.urlopen('http://python.org')
> > return_str = conn.read()
>
> > fp = open('python.html','w').write(return_str)




More information about the Python-list mailing list