0
我想訪問way2sms這是使用機械化密碼保護的網站保護的網站。密碼 - 用機械化
import mechanize
br = mechanize.Browser()
br.open('http://site2.way2sms.com/content/index.html')
for form in br.forms():
print form
這給這個
<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)>>
然後我做了這個
br.select_form(nr = 0)
br.form['username']= 'My mobile'
br.form['password'] = 'Password'
br.submit()
br.response().read()
這使頁面的HTML登錄後,但我怎麼能在登錄前得到的頁面。能有人幫忙?