Pls chk my login script

nusrath ahmed nusrathahmed at
Mon Apr 25 00:05:11 CEST 2011

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 = ''

    id    = 'u2'
    passw = 'p2'

    fieldId   = 'username'
    fieldPass = 'password'
    cj = cookielib.CookieJar()
    data = urllib.urlencode({fieldId:id, fieldPass:passw})

    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))


    usock =
    usock =,  data)

    pageSource =
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list