Pass ID and password to the server
Steven D'Aprano
steven at REMOVE.THIS.cybersource.com.au
Tue Apr 14 00:11:17 EDT 2009
On Mon, 13 Apr 2009 21:02:39 -0700, larryzhang wrote:
> Hi,
>
> I am trying to grab webpages from a site that requires user ID and
> password, is there a way that I can pass my ID and password to the
> server? Thanks.
It depends on what the server is expecting.
Some *really bad* systems encode the username and password in the URL. If
that's what the server does, then just copy the URL. Easy.
Python can handle basic authentication easily. Have a read of these:
http://www.voidspace.org.uk/python/articles/urllib2.shtml
http://www.voidspace.org.uk/python/articles/authentication.shtml
I'm not sure about digest authentication, but it's probably similar.
If the website uses javascript to manage authentication, you've probably
got a lot of work to do.
--
Steven
More information about the Python-list
mailing list