-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun.py
51 lines (36 loc) · 1.44 KB
/
run.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
import time
from services.bot import Bot
from services.setting_loader import SettingLoader
from utils.logging_util import log_message
def run():
items = SettingLoader.load_items()
billing_info = SettingLoader.load_billing_info()
bot = Bot("https://www.supremenewyork.com/mobile#categories/new")
start_time = time.time()
item_index = 0
while item_index < len(items):
item = items[item_index]
bot.go_to_start_page()
while bot.is_on_start_page():
if not bot.select_item(item.name):
bot.refresh()
log_message(f"Item {item.name} selected.")
if item.color and bot.select_color(item.color):
log_message(f"Color {item.color} selected.")
if bot.select_size(item.size):
log_message(f"Size {item.size} selected.")
if bot.add_to_cart():
item_index += 1
log_message(f"Item {item.name} successfully added to cart.")
if bot.go_to_checkout():
log_message("Proceeded to checkout successfully.")
log_message("Filling in the checkout form.")
bot.fill_in_checkout_form(billing_info)
if bot.agree_to_terms():
log_message("Agreed to terms.")
# Uncomment this block of code to process the payment automatically
# if bot.process_payment():
# log_message("Payment is processing.")
log_message(f"Total time: {time.time() - start_time}")
if __name__ == "__main__":
run()