Web client login with redirection and cookies

John john_lewis at mindspring.com
Thu Aug 8 03:12:18 CEST 2002


Thanks for your help John,

I was actually able to get something to work with ClientCookie.  My
problem was that I was making it harder than necessary.  This seems to
work, although now in retrospect I may have been able to simplify the
Perl as well.

import urllib, urllib2, ClientCookie
params = urllib.urlencode({'loginid': 'id', 'password': 'pass',
'next': 'http://site/reports/drill.php', 'submit': 'ENTER'})
request = urllib2.Request("http://site/login_gen.php", params)
result = ClientCookie.urlopen(request)

Sorry for the dumb question.  I'll try to improve any future posts.  

John



More information about the Python-list mailing list