views:

38

answers:

1

I have this login page with https, and i reach to this approach::

import ClientForm
import urllib2

request = urllib2.Request("http://ritaj.birzeit.edu")
response = urllib2.urlopen(request)
forms = ClientForms.ParseResponseEx(response)
response.close()

f = forms[0]
username = str(raw_input("Username: "))
password = str(raw_input("Password: "))

## Here What To Do

request2 = f.click()

i get the controls of that page

>>> f = forms[0]
>>> [c.name for c in f.controls]
['q', 'sitesearch', 'sa', 'domains', 'form:mode', 'form:id', '__confirmed_p', '__refreshing_p', 'return_url', 'time', 'token_id', 'hash', 'username', 'password', 'persistent_p', 'formbutton:ok']

so how can i set the username and password controls of the "non-form form" f ??? and i have another problem,, how to know if its the right username and password ??

+1  A: 

You set f['username'] = username and f['password'] = password, and when you f.click() you'll get a response that you'll need to examine in order to determine whether those strings were the ones the site you're visiting expected -- how the site communicates that depends on the site, it should use an HTTP status for the purpose but some sites are very sloppy that way, so you may have to scrape their response page instead.

Alex Martelli
Thanks, but how should i scrape their response page??,, and this page i want is using HTTPS..
Rami Jarrar