[Twisted-web] Proxy Authentication with a Password Protected Site

Robert Hancock hancock.robert at gmail.com
Tue Sep 23 15:05:14 EDT 2008


Thank  you for all your help.  This worked.

        # Proxy credentials
        proxyAuth = base64.encodestring('%s:%s' % (proxy_username,
proxy_password))
        proxy_authHeader = "Basic " + proxyAuth.strip()

        # Web site credentials
        basicAuth = base64.encodestring('%s:%s' % (username, password))
        authHeader = "Basic " + basicAuth.strip()

        return client.getPage(url, headers={"Authorization":
authHeader, 'Proxy-Authenticate': proxy_authHeader})


On Mon, Sep 22, 2008 at 11:13 AM, Phil Mayers <p.mayers at imperial.ac.uk> wrote:
>
>>>
>>> Thanks for the rapid reply. This is my first attempt at Twisted.
>>>
>>
>> This looks largely correct to me.  I don't have a proxy (and I definitely
>> don't have /your/ proxy) to actually test it against, so I may be missing
>> something.  One thing that does come to mind is that a proxy might require
>> that the request URL is absolute rather than relative (<http://foo/bar>
>> instead of </bar>).  I'm not sure when exactly this is required, nor how
>> to convince `getPage´ to make a request of that form.  This might be
>> related
>> to <http://twistedmatrix.com/trac/ticket/2714>.
>
> Most transparent proxies do not, but AFAIK transparent proxies can't
> authenticate, for obvious reasons.
>
> See also:
>
> http://twistedmatrix.com/pipermail/twisted-python/2008-July/018150.html
>
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>



More information about the Twisted-web mailing list