0

Hello, I'm trying to make a web bot that fills out a login form from this at&t site
http://www.viewmymessage.com/en/legacy/login.jsp

I cannot seem to get it to work though here is my code:

import urllib
import urllib2

url = 'http://www.viewmymessage.com/en/legacy/login.jsp'

user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'

values = {'messageId' : 'i1stbnan7','password' : 'tax3akin'}
headers = { 'User-Agent' : user_agent }

data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
print response.read()

3
Contributors
3
Replies
5
Views
9 Years
Discussion Span
Last Post by preyan
1

I figured it out by using a library called clientform. Incase anyone else has this problem heres the working code:

from urllib2 import urlopen
from ClientForm import ParseResponse

response = urlopen("http://www.viewmymessage.com/en/legacy/login.jsp")
forms = ParseResponse(response, backwards_compat=False)
form = forms[0]
print form

original_text = form["messageId"]
form["messageId"] = "i1stbnan7"

original_text = form["password"]
form["password"] = "tax3akin"


print urlopen(form.click()).read()

Votes + Comments
thanks for the solution
0

I tried working with your example its works good
extending further, when my first page opens which is a javascript
there is a hyperlink which activates a control
when i used the click on the hyperlink it says that is not clickable(may be cause its not a button)
how do i have to activate the link, using the click event

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.