Open a URL

Joonas Paalasmaa joonas at olen.to
Thu May 3 15:41:07 EDT 2001


michael montagne wrote:
> 
> I need to walk through a thousand emails, go to the URL listed in them and
> save the resulting HTML to my local drive.  The URL seems to be some sort of
> CGI script.  It looks something like this:http://www...C7?Opendocument.  It
> also requires a username and password.  How can I accomplish this task?

import urllib
file =
urllib.urlopen("http://www...C7?Opendocument","pass=MyPaSS&user=myName")
print file

The urlopen-function passes data in second argument into url in the
first argument with POST method and returns contents of that url.
When second argument is omitted url is retrieved with GET method.



More information about the Python-list mailing list