Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '__name__': 0.07; 'urllib2': 0.07; 'python': 0.07; '(unless': 0.09; 'httplib': 0.09; 'received:209.85.160.174': 0.09; 'received:mail- gy0-f174.google.com': 0.09; 'sun,': 0.09; 'pm,': 0.11; 'written': 0.12; 'skip:* 40': 0.14; 'wrote:': 0.14; '"action"': 0.16; "'__main__':": 0.16; 'nay': 0.16; 'pulls': 0.16; 'subject:login': 0.16; 'suggest': 0.19; '24,': 0.19; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:addr:python- list': 0.22; 'specified': 0.22; 'script': 0.26; 'correct': 0.26; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; 'received:209.85.160': 0.28; 'cc:addr:python.org': 0.31; 'does': 0.31; 'supposed': 0.31; 'import': 0.32; 'page': 0.33; 'post': 0.34; 'follow-up': 0.35; 'url:gmail': 0.35; 'data': 0.37; 'skip:o 20': 0.37; 'received:209.85': 0.37; 'apr': 0.38; 'logging': 0.38; 'thread': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'log': 0.38; 'submit': 0.39; 'received:209': 0.39; 'form,': 0.40; 'header:Received:5': 0.40; '8bit%:9': 0.60; 'happen': 0.61; '2011': 0.62; 'website.': 0.63; 'below': 0.63; 'browser': 0.64; 'to:addr:yahoo.com': 0.83; 'data)': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=c64rBltVI6mB56hl/H/8nXvpU5K0Xsw7XueecqY8IQw=; b=MNRxYUOpMZGjZ5zqnma7rJAVYysR5rWQiMARkFLjITRtMdSucH9saqtLNRjpImCemU 62UY4Lj4mEcrVAquYu+eWt47ND5XkoU8z7C1hOymBhmN6THJTmLEAH8mVyFAGnQ8CsHD QokxfuF7IADR/1VmL0SvR4dj3AlolU5DUtwXA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=NGldsOmnQDhHr1TrvSyPbR1SPqceE0bkB1FDy2qtG4SxdGruJG8QLk4zSMbYwBzJjU S8/3tY6NKX5NxVAEsrc/cGANGHu0pohjDVwYDIeoWEbPyPYu0AEQFEGNf1V9TQ5b/IRR MawUTxLVK/oTmXNSoine7KfyAxNGyfjhiUCZI= MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: <38695.65654.qm@web110506.mail.gq1.yahoo.com> References: <38695.65654.qm@web110506.mail.gq1.yahoo.com> Date: Sun, 24 Apr 2011 15:41:42 -0700 X-Google-Sender-Auth: ljJTNJL1DneLQy_uaBZpGvEcrD8 Subject: Re: Pls chk my login script From: Chris Rebert To: nusrath ahmed Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303684912 news.xs4all.nl 41110 [::ffff:82.94.164.166]:33552 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3965 On Sun, Apr 24, 2011 at 3:05 PM, nusrath ahmed wro= te: > I have written a python script for logging into a website. My script pull= s > 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__ =3D=3D '__main__': > =C2=A0=C2=A0=C2=A0 urlLogin =3D 'http://www.gmail.com' > > =C2=A0=C2=A0=C2=A0 id=C2=A0=C2=A0=C2=A0 =3D 'u2' > =C2=A0=C2=A0=C2=A0 passw =3D 'p2' > > =C2=A0=C2=A0=C2=A0 fieldId=C2=A0=C2=A0 =3D 'username' > =C2=A0=C2=A0=C2=A0 fieldPass =3D 'password' > > =C2=A0=C2=A0=C2=A0 cj =3D cookielib.CookieJar() > =C2=A0=C2=A0=C2=A0 data =3D urllib.urlencode({fieldId:id, fieldPass:passw= }) > =C2=A0=C2=A0=C2=A0 usock =3D opener.open(urlLogin,=C2=A0 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