Pls chk my login script

Chris Rebert clp2 at rebertia.com
Sun Apr 24 18:41:42 EDT 2011


On Sun, Apr 24, 2011 at 3:05 PM, nusrath ahmed <nusrathahmed at 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


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /