[Tutor] Using urllib to retrieve info

Kent Johnson kent37 at tds.net
Tue Aug 9 13:27:55 CEST 2005

David Holland wrote:
> Alan,
> Sorry of course that is the problem.  These pages are
> password protected !!!! 
> Is it possible to download password protected pages (I
> know the password but I don't how to get the program
> to use it).

urllib2 supports basic and digest authentication. There ale examples using basic auth here:

If the server uses form-based auth I think you will have to post to the form yourself and maybe set up urllib2 to handle cookies as well. Look at the login form and you may be able to figure out how to post the results directly. The second link above also has a cookie example.


More information about the Tutor mailing list