Include me in the list

2011-04-24 Thread nusrath ahmed
I have written a python script for logging into a website. For the  time being 
I 
have created a login page and a website which I want to log  in. My script 
pulls 
up the  login page but does not post the username  and password and log me in. 
It simple displays the login page. I wanted  my script to log me in also. Can 
some body please go through the script  and correct me/ help me login.

My script is as below


*
import cookielib
import urllib
import urllib2
import httplib

if __name__ == '__main__':
urlLogin = 
'file:///C:/Documents%20and%20Settings/Fat/Desktop/New%20Folder/Login.html'

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))

urllib2.install_opener(opener)

usock = opener.open(urlLogin)
usock = opener.open(urlLogin,  data)

pageSource = usock.read()
usock.close()
print(pageSource)

*
-- 
http://mail.python.org/mailman/listinfo/python-list


Pls chk my login script

2011-04-24 Thread nusrath ahmed
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})

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

urllib2.install_opener(opener)

usock = opener.open(urlLogin)
usock = opener.open(urlLogin,  data)

pageSource = usock.read()
usock.close()
print(pageSource)

*-- 
http://mail.python.org/mailman/listinfo/python-list


Python login script

2011-04-25 Thread nusrath ahmed
I have written a python script that should log me in to a website. For the time 
being I want to login to gmail.com. My script pulls up the gmail webpage but 
does not input the login id and the password in the fields and  does not log me 
in. I assume I am missing on something in my script. Can some body have a look 
as to what I am missing on.

import cookielib
import urllib
import urllib2
import httplib

if __name__ == '__main__':
urlLogin = 'http://www.gmail.com'

id= 'u2'
passw = 'p2'

fieldId   = 'Email'
fieldPass = 'passwd'

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

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

urllib2.install_opener(opener)

usock = opener.open(urlLogin)
usock = opener.open(urlLogin,  data)

pageSource = usock.read()
usock.close()
print(pageSource)-- 
http://mail.python.org/mailman/listinfo/python-list