[Tutor] Re: Web page capture

Emile van Sebille emile@fenx.com
Wed, 21 Aug 2002 06:09:07 -0700


Schmidt, Allen J.
> Is it possible to use URLLIB (or something else) to mimic the process
of
> going to a URL, entering a userid and password and saving the
resulting page
> to a file or as a field in a database? I have looked a bit at URLLIB
but
> have not seen any way to enter the authentication stuff. Also how to
> actually save the html code itself to a file that can be called from a
DB
> and rendered later.
>

One way is to include the userid and passwd in the url:

tempfile, msg =
urllib.urlretrieve("http://userid:passwd@somewhere.com:8080/required/pag
e")

which then allows:

data = open(tempfile).read()

HTH,

--

Emile van Sebille
emile@fenx.com

---------