Module urllib

Ng Pheng Siong ngps at madcap.dyn.ml.org
Wed Dec 22 09:48:58 EST 1999


According to Michael Husmann  <Michael.Husmann at digitalmap.hi.bosch.de>:
> What is to be done to open an url when I fist have to pass a firewall? 

Depends on the sort of firewall in your way. ;-) 

If you are using a web proxy, it suffices to have environmental 
variables like these:

    http_proxy=http://proxy.mydomain.com:8080/
    ftp_proxy=http://proxy.mydomain.com:8080/


> I would like to use the function urlopen, but I don't
> know how to pass my User ID and my Password.

Several possible interpretations of the above here:

1. You are accessing a URL that demands http basic authentication.
Speak your url thusly:

    http://username:password@www.what.ever.com/what/ever/path

2. You are accessing a URL that is a form with username and 
password entry fields to be filled in. You'll need to find out 
the form's action: GET or POST. See the recent thread of how to 
GET/POST to a URL. 

3. Your web proxy demands http basic authentication before doing
its business for you. I think an environmental variable like this

    http_proxy=http://proxy_user:proxy_password@proxy.../

should work. Of course, this exposes your proxy username/password
in your environment. If you don't want this, you'll need to have
your own local proxy that accepts the username/password upon startup,
caches it in memory, then sends it on to the upstream proxy everytime
it does its business for you. 

Look around Parnassus: Several people have written ad/cookie-junking
proxies. Try them out.

Cheers.


-- 
Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps




More information about the Python-list mailing list