basic web auth and verification

scripteaze at gmail.com scripteaze at gmail.com
Tue Oct 23 01:14:01 EDT 2007


Trying to figure out how to add login verfication. I believe it is
logging me in, but theres no way to really tell..any ideas? or
tutorials out there that can exaplain this to me?

Thanks

import urllib,urllib2,cookielib

passlst = open(passfile, 'r').readlines()
url="http://somesite"
cj = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
TheForm = urllib.urlencode({"username":"myid","password":"mypas"})
request = urllib2.Request(url, TheForm)
result = urllib2.urlopen(request)
html=result.read()
result.close()




More information about the Python-list mailing list