I want to make a script that fills out raffle forms in the background.
I saw a script online and edited to my belongs.
Now I found an error and don't know how to fix it because im a beginner.
It would be cool if some one can help me.
File "main.py", line 58 test = sesh.post(url,data=data) ^ IndentationError: unindent does not match any outer indentation level
Script:
import requests, time, names, random, json, string
from random import randint, choice
#
sizes = ['EUR 40 | US 7','EUR 40.5 | US 7.5','EUR 41 | US 8','EUR 42 | US 8.5','EUR 42.5 | US 9','EUR 43 | US 9.5','EUR 44 | US 10','EUR 44.5 | US 10,5','EUR 45 | US 11','EUR 45.5 | US 11.5','EUR 46 | US 12','EUR 47 | US 12.5','EUR 47.5 | US 13']
#
def session():
sesh = requests.session()
sesh.headers = {
'Origin':'https://www.sneakerdistrict.com',
'Referer':'https://www.sneakerdistrict.com/wotherspoon/',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36'
}
sesh.headers.update()
return sesh
#
def proxysession(proxy):
ip,port,username,password = proxy.split(":")
formattedProxy = (username+':'+password+'@'+ip+':'+port)
proxies = {'http': 'http://'+formattedProxy}
proxies = {'https': 'https://'+formattedProxy}
sesh = requests.Session()
sesh.proxies = proxies
sesh.headers = {
'Origin':'https://www.sneakerdistrict.com',
'Referer':'https://www.sneakerdistrict.com/wotherspoon/',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36'
}
sesh.headers.update()
return sesh
#first,last,email,street,zip,city,country,telephone,size
def post(sesh,url,first,email,street,zip,city,country,telephone,size,delay):
data = {
'form_fields[0][name]': 'first_name',
'form_fields[0][value]': first,
'form_fields[1][name]': 'last_name',
'form_fields[1][value]': last,
'form_fields[2][name]': 'email',
'form_fields[2][value]': email,
'form_fields[3][name]': 'street',
'form_fields[3][value]': street,
'form_fields[4][name]': 'zip',
'form_fields[4][value]': zip,
'form_fields[5][name]': 'city',
'form_fields[5][value]': city,
'form_fields[6][name]': 'country',
'form_fields[6][value]': country,
'form_fields[7][name]': 'telephone',
'form_fields[7][value]': telephone,
'form_fields[8][name]': 'size',
'form_fields[8][value]': size,
}
test = sesh.post(url,data=data)
if '{"status":"success"}'==test.text:
print("Entered successfully:")
signup = first,last,email,street,zip,city,country,telephone,size
print(signup)
f = open('entries.txt','a')
f.write(str(signup)+'\n')
f.close
time.sleep(delay)
def main:
with open('config.json') as json_data_file:
data = json.load(json_data_file)
form = data['settings']['form']
catchalldomain = data['settings']['catchalldomain']
randomnames = data['settings']['randomnames']
first = data['settings']['setfirst']
last = data['settings']['setlast']
signupdelay = int(data['settings']['signupdelay'])
randomsizes = data['settings']['randomsizes']
size = data['settings']['size']
street = data['settings']['setstreet']
zip = data['settings']['setzip']
city = data['settings']['setcity']
country = data['settings']['country']
telephone = data['settings']['telephone']
proxyuse = data['settings']['useproxy']
proxy = data['settings']['proxy']
#
if randomnames == 'True':
first = names.get_first_name(gender='male')
last = names.get_last_name()
randomletters = "".join(choice(string.ascii_letters) for x in range(randint(1, 4)))
username = randomletters+first+randomletters
email = username+'@'+catchalldomain
if randomsizes == 'True':
size = random.choice(sizes)
if proxyuse == 'True':
sesh = proxysession(proxy)
else:
sesh = session()
#
post(sesh,form,first,last,email,street,zip,city,country,telephone,size,signupdelay)
print("Raffle Bot")
with open('usernames.txt') as f:
content = f.readlines()
for i in content:
main(i)
This is the config.json:
{
"settings":{
"form":"https://www.sneakerdistrict.com/wotherspoon/app/ajax/form-submit.php",
"catchalldomain":"test@club",
"randomnames":"False",
"setfirst":"Test",
"setlast":"Test",
"signupdelay":"5",
"randomsizes":"True",
"size":"EUR 44 | US 10",
"setstreet":"Ave",
"setzip":"607998",
"setcity":"Dayton",
"country":"United States",
"telephone":"154577697",
"useproxy":"False",
"proxy":"ip:port:username:password"
}
}