Pass ID and password to the server

Steven D'Aprano steven at
Tue Apr 14 06:11:17 CEST 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:

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.


More information about the Python-list mailing list