gpt4 book ai didi

python - 如何循环使用 Mechanize 的 Python 脚本?

转载 作者:行者123 更新时间:2023-12-04 16:22:49 24 4
gpt4 key购买 nike

我试图循环这个 python 脚本,所以我可以无限次地填写表单。当我尝试循环播放时,它只会从网站收到一封确认电子邮件。我的代码有什么问题?

import mechanize


#This bot allows for autofill on the ShoezGallery Raffle.
br = mechanize.Browser()

response = br.open("https://www.bstnstore.com/yeezy-boost-350-v2-zebra-raffle")

br.addheaders = [("User-agent","Mozilla/5.0")]

url = "https://www.bstnstore.com/yeezy-boost-350-v2-zebra-raffle"

br.select_form(nr=2)

emailAddress = 'my email'

br['EMAIL'] = emailAddress #DONT CHANGE

br['MMERGE3'] = emailAddress #DONT CHANGE

br.form.find_control(name="MMERGE4", kind="list").value = ["US 9.5 (EU 43 1/3)"]

br['FNAME'] = 'Julio'

br['LNAME'] = 'my last name'

br['MMERGE6'] = 'my phone number'

br['MMERGE5[addr1]'] = 'my address'

br['MMERGE5[addr2]'] = 'Floor 1'

br['MMERGE5[city]'] = 'my town'

br['MMERGE5[state]'] = 'my state'

br['MMERGE5[zip]'] = 'my zip'

br.form.find_control(name="MMERGE5[country]", kind="list").value = ["164"]


br.submit()


for i in range(1,1000000):
print 'Signed Up'

最佳答案

您要重复的代码需要在 for 循环内。如果你真的想让代码无限重复,你也可以考虑把它放在一个while循环中:

import mechanize

while True: #(The code will repeat forever)
#This bot allows for autofill on the ShoezGallery Raffle.
br = mechanize.Browser()

response = br.open("https://www.bstnstore.com/yeezy-boost-350-v2-zebra-raffle")

br.addheaders = [("User-agent","Mozilla/5.0")]

url = "https://www.bstnstore.com/yeezy-boost-350-v2-zebra-raffle"

br.select_form(nr=2)

emailAddress = 'my email'

br['EMAIL'] = emailAddress #DONT CHANGE

br['MMERGE3'] = emailAddress #DONT CHANGE

br.form.find_control(name="MMERGE4", kind="list").value = ["US 9.5 (EU 43 1/3)"]

br['FNAME'] = 'Julio'

br['LNAME'] = 'my last name'

br['MMERGE6'] = 'my phone number'

br['MMERGE5[addr1]'] = 'my address'

br['MMERGE5[addr2]'] = 'Floor 1'

br['MMERGE5[city]'] = 'my town'

br['MMERGE5[state]'] = 'my state'

br['MMERGE5[zip]'] = 'my zip'

br.form.find_control(name="MMERGE5[country]", kind="list").value = ["164"]


br.submit()
print 'Signed Up'

关于python - 如何循环使用 Mechanize 的 Python 脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44598165/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com