我想用刮刮方式2发送短信短信网,但我无法登录way2短信网使用mechanize。在
我使用以下代码提交登录表单。在
import mechanize
br = mechanize.Browser()
br.set_handle_robots(False)
br.set_handle_refresh(False)
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0')]
res=br.open('http://wwwa.way2sms.com/content/prehome.jsp')
link=list(br.links())[5]
res=br.follow_link(link)
br.form = list(br.forms())[0]
br.form.find_control('username').value=USERNAME #user name
br.form.find_control('password').value=PASSWORD #password
res=br.submit()
提交表单后,再次收到登录页面。在
只需将用户名和密码替换为用户名和密码。在
相关问题 更多 >
编程相关推荐