Proxy authentication required

gervaz gervaz at gmail.com
Tue Mar 22 04:34:36 EDT 2011


On 22 Mar, 00:02, Chris Rebert <c... at rebertia.com> wrote:
> On Mon, Mar 21, 2011 at 2:38 AM, gervaz <ger... at gmail.com> wrote:
> > Hi all,
> > I've got to download some web pages but I'm behind a proxy. So far
> > this is what I've used without any successful result receiving the
> > error: "urllib.error.HTTPError: HTTP Error 407: Proxy Authentication
> > Required ( The ISA Server requires auth
> > orization to fulfill the request. Access to the Web Proxy filter is
> > denied.  )":
>
> > hc = urllib.request.HTTPCookieProcessor()
> > hp = urllib.request.ProxyHandler({"http": "10.242.38.251:80",
> > "username": "domain\username", "password": "password"})
>
> Remember that backslash is used for string escapes in Python; so that
> should be "domain\\username" in order to get 1 literal backslash. I
> suspect this is the cause of your proxy authentication problem.
>
> > opener = urllib.request.build_opener(hc, hp)
>
> Are you sure that's the right order for the handlers? (I don't know myself.)
>
> > urllib.request.urlopen("http://www.google.it/")
>
> Cheers,
> Chris
> --
> Windows, Y U use backslash for stuff!?http://blog.rebertia.com

Hi Cris,
I had already tested the solution with the '\\' but the result is the
same. As per the arguments order, build_opener thakes *handlers as
argument so no problem.

Mattia



More information about the Python-list mailing list