how to browse using urllib2 and cookeilib the correct way

Edward Elliott nobody at 127.0.0.1
Wed Apr 26 01:53:36 EDT 2006


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.



More information about the Python-list mailing list