-
Notifications
You must be signed in to change notification settings - Fork 0
/
raffler.py
77 lines (64 loc) · 2.21 KB
/
raffler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import csv, requests
class Profile:
"""Represents a profile to enter."""
def __init__(self, row):
self.email = row[0]
self.first = row[1]
self.last = row[2]
self.zip = row[3]
self.phone = row[4]
def load_profiles():
"""Loads profiles from a CSV format."""
profile_list = []
with open("./data.csv") as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
row_id = 0
for row in csv_reader:
if row_id != 0:
profile_list.append(Profile(row))
row_id += 1
return profile_list
def enter_raffle(email, first, last, zip, phone, size):
"""Enters raffle"""
headers = {
'authority': 'f1eb5xittl.execute-api.us-east-1.amazonaws.com',
'sec-ch-ua': '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
'accept': 'application/json, text/plain, */*',
'sec-ch-ua-mobile': '?0',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
'dnt': '1',
'origin': 'https://shop.travisscott.com',
'sec-fetch-site': 'cross-site',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
'referer': 'https://shop.travisscott.com/',
'accept-language': 'en-US,en;q=0.9',
}
params = (
('a', 'm'),
('email', email),
('first', first),
('last', last),
('zip', zip),
('telephone', phone),
('product_id', phone),
('kind', 'shoe'),
('size', size),
)
response = requests.get('https://f1eb5xittl.execute-api.us-east-1.amazonaws.com/fragment/submit', headers=headers, params=params)
if response.status_code == 200:
print(f"Successfully entered {email}")
else:
print(f"Failed enter {email} ({str(response.status_code)})")
if __name__ == "__main__":
size = input("Size: ")
profiles = load_profiles()
for profile in profiles:
enter_raffle(
email=profile.email,
first=profile.first,
last=profile.last,
zip=profile.zip,
phone=profile.phone,
size=size
)