Using proxy

David Currie davec999 at my-deja.com
Wed Jul 12 05:22:38 EDT 2000


In article <396C0C19.8F1C940D at adtranzsig.de>,
  laukien at gmx.de wrote:
> The solution is quite simple:
>
> import httplib
> proxyhost = 'proxy'
> proxyport = 8080
>
> h = httplib.HTTP(proxyhost, proxyport)
> ....
[additional info because this isn't really clear]

When making a request you will have to ask
for "http://www.host.com/page.html" instead of, say, "/page.html" like
you would have to when connecting directly to the host.

Make sure your proxy does not require authentication.  If it does, look
at the headers returned with the error code to see what kind it wants.
Basic authentication is simple: you include an extra header in the
request with the text "Proxy-Authorization: <auth>" where
<auth>==base64.encode("username:password"). Digest is more complicated
and needs encryption.  I don't know how to do this.. :)

If the proxy is IIS it is possible that it uses something called NTLM
authentication.  If this is the case, forget it unless you implement
the protocol.  There is some documentation somewhere on the net.

Sorry, this started as a clarification, but I think I may have
complicated things.. :/

Dave


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list