Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3965
| References | <38695.65654.qm@web110506.mail.gq1.yahoo.com> |
|---|---|
| Date | 2011-04-24 15:41 -0700 |
| Subject | Re: Pls chk my login script |
| From | Chris Rebert <clp2@rebertia.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.807.1303684912.9059.python-list@python.org> (permalink) |
On Sun, Apr 24, 2011 at 3:05 PM, nusrath ahmed <nusrathahmed@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
Back to comp.lang.python | Previous | Next | Find similar
Re: Pls chk my login script Chris Rebert <clp2@rebertia.com> - 2011-04-24 15:41 -0700
csiph-web