how to browse using urllib2 and cookeilib the correct way

John J. Lee jjl at pobox.com
Wed Apr 26 16:58:07 EDT 2006


Edward Elliott <nobody at 127.0.0.1> writes:

> jnair at ensim.com wrote:
> > can anybody explain, in the first case why i need to do two attempts.
> 
> I would guess it's because redhat requires your browser to submit a session
> cookie with the login form.  In the urllib2 example, the first request you
> make tries to submit login form data directly.  Since it's your first hit
> on their site, you don't have a cookie yet.  People browsing interactively
> would at least load the login page first before submitting it.
> 
> Your twill example takes care of this by requesting a page before trying to
> login.
> 
> That would be my guess.

Uh, yeah you're right actually.  Forget what I said about Refresh...


John




More information about the Python-list mailing list