Making urllib2's POST 302 handle same as Perl LWP's behaviour

Karra skarra at gmail.com
Wed Dec 29 07:35:42 EST 2010


On Dec 29, 3:57 pm, Karra <ska... at gmail.com> wrote:

> Can someone point me to how I can get the default LWP:UserAgent
> behaviour of handling this scenario using urllib2?

Out of frustration, I decided to give 'mechanize' a try. It came as an
awesome surprise that mechanize implements the exact api of urllib2 -
meaning all I had to do was a query-replace of urllib2 to mechanize,
and lo-and-behold I got what I wanted!

Which is to say, the behaviour of mechanize matches Perl's
LWP::UserAgent as afar as handling of POST redirects go.



More information about the Python-list mailing list