I want to access way2sms which is a password protected site using mechanize.
import mechanize
br = mechanize.Browser()
br.open('http://site2.way2sms.com/content/index.html')
for form in br.forms():
print form
which gives this
<loginform POST http://site2.way2sms.com/content/index.html application/x-www-form-urlencoded
<IgnoreControl(button2=<None>)>
<TextControl(username=Mobile Number)>
<PasswordControl(password=******)>
<SubmitControl(button=Login) (readonly)>>
Then I did this
br.select_form(nr = 0)
br.form['username']= 'My mobile'
br.form['password'] = 'Password'
br.submit()
br.response().read()
This gives the html of the page after logging in but how can I get the page before logging in. Can someone help?