urllib2 request htaccess page through proxy

John J. Lee jjl at pobox.com
Sun Feb 11 15:55:13 EST 2007


Alessandro Fachin <Alessandro.Fachin at gmail.com> writes:

> I write this simply code that should give me the access to private page with
> htaccess using a proxy, i don't known because it's wrong... 
[...]
> i get no access on access.log from apache2 and nothing from the proxy in
> tcpdump log. If i use only the proxy with a page that doesn't use htaccess
> it works... if anyone could help,regards...
[...]
> urllib2.HTTPError: HTTP Error 401: Authorization Required

Works for me (using Squid and Apache both running on localhost).
Looking at what goes over the wire, I see a 401 followed by a 299
response, which is what is expected (the 401 prompts the client to
send the username and password, which is then rewarded with the 200).

Could you describe in more detail what your proxy and Apache
configuration are like?  And more about your network (on what machines
do proxy, HTTP server, and HTTP client run -- all on the same machine,
some on the same machine, all three on three different machines?)  The
more detail the better.


John



More information about the Python-list mailing list