Need Pattern For Logging Into A Website

Michael Torrie torriem at
Fri Jan 25 20:18:11 CET 2013

On 01/25/2013 09:18 AM, Tim Daneliuk wrote:
> On 01/25/2013 10:01 AM, Steve Petrie wrote:
>> On Thursday, January 24, 2013 8:29:51 PM UTC-5, Tim Daneliuk
>> wrote: The mechanize module
>> ( might be a place to
>> start.  I've done something similar with code like this:
> Thanks.

I've had good luck using urllib2 and a cookiejar.  Just post your login
credentials against the login url, keep all the cookies and then make
your other requests using that cookiejar.  Besides the Python standard
library docs on urllib2 and cookielib, here's an article that gives an
overview of how to use it:

This technique has the advantage of not requiring anything outside of
the standard library.

More information about the Python-list mailing list