【发布时间】:2017-11-17 08:11:41
【问题描述】:
我正在尝试在 Python 上编写一个脚本,该脚本使用 Mechanize 在此 website 表单上自动填充表单。由于没有 Capatcha,该脚本应该能够循环并在表单上创建无限条目。
虽然我对 Python 和 Mechanize 还很陌生,但我了解基础知识并且对 HTML 相当了解,但我仍在寻求帮助。
如果有人能提供帮助,我将不胜感激。
这就是我目前所拥有的......
import mechanize
#This bot allows for autofill on the ShoezGallery Raffle.
browser = mechanize.Browser()
response = br.open("http://yeezy.shoezgallery.com/")
br.addheaders = [("User-agent","Mozilla/5.0")]
url = "http://yeezy.shoezgallery.com/"
browser.select_form(nr=0)
browser.form['nom'] = Last name
browser.form['prenom'] = First Name
browser.form['mail'] = my email here
browser.form['telephone'] = phone number here
browser.form['taille'] = 4313
browser.form['pays'] = Etats_Unis
brower.submit()
response = browser.open('http://yeezy.shoezgallery.com/')
print response.read()
编辑 代码格式改变。
【问题讨论】:
标签: python html forms mechanize