On Sun, Apr 24, 2011 at 3:05 PM, nusrath ahmed <nusrathah...@yahoo.com> wrote: > I have written a python script for logging into a website. My script pulls > up a browser page but does not log me in. Can any one suggest if I i am > wrong in nay way,though the script is correct I am sure > > My script is as below > > > ********************************************* > import cookielib > import urllib > import urllib2 > import httplib > > if __name__ == '__main__': > urlLogin = 'http://www.gmail.com' > > id = 'u2' > passw = 'p2' > > fieldId = 'username' > fieldPass = 'password' > > cj = cookielib.CookieJar() > data = urllib.urlencode({fieldId:id, fieldPass:passw}) <snip> > usock = opener.open(urlLogin, data)
You're supposed to submit to the "action" URL specified by the form, not the URL the form itself is on (unless they happen to be the same). Also, please don't make a whole new thread just to post a follow-up reply. Regards, Chris -- http://mail.python.org/mailman/listinfo/python-list