Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,17 @@ Here is a list and description of the different arguments to use for the script:

<b>--dont-quit</b>
* Prevent window from closing (not headless mode). Useful if you wish to continue checkout process manually after Buy button is clicked

# GUI Guide

The GUI is built with PySimpleGUI
```
pip install PySimpleGUI
```

<b>Launch the GUI by running</b>
```
python3 gui.py
```
<b>Changing arguments</b>
the ```runcommand``` variable holds all the arguments in a string and they can be configured in the manner listed in the "Configuration Options" settings above
40 changes: 40 additions & 0 deletions gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import PySimpleGUI as sg
import main
import sys
import subprocess

sg.theme('DarkAmber')

layout = [[sg.Text('Enter Nike Account information')],
[sg.Text('Username', size=(15, 1) ), sg.InputText(key='-user-')],
[sg.Text('Password', size=(15, 1) ), sg.InputText(key='-pass2-')],
[sg.Text('URL', size=(15, 1)), sg.InputText(key='-url-')],
[sg.Text('Size', size=(15, 1)), sg.InputText(key='-size-')],
[sg.Submit('Submit'), sg.Cancel()]]

window = sg.Window('Slippery', layout)

event, values = window.Read()

user = values['-user-']
pass2 = values['-pass2-']
url = values['-url-']
size = values['-size-']

runcommand = 'python main.py --username {} --password {} --url {} --shoe-size {} --driver-type chrome --num-retries 3'.format(user, pass2, url, size)

if event == 'Submit':
subprocess.call(runcommand)
try:
check = subprocess.check_output(runcommand)

except subprocess.CalledProcessError as e:
check = e.output
while True: # The Event Loop
event, values = window.read()
print(event, values)
if event == sg.WIN_CLOSED or event == 'Exit':
break


print(check)
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
NIKE_HOME_URL = "https://www.nike.com/login"
LOGGER = logging.getLogger()



def run(driver, shoe_type, username, password, url, shoe_size, login_time=None, release_time=None,
page_load_timeout=None, screenshot_path=None, html_path=None, select_payment=False, purchase=False,
num_retries=None, dont_quit=False):
Expand Down Expand Up @@ -191,7 +193,7 @@ def retry_login(driver, username, password):
else:
LOGGER.info("Too many login attempts. Please restart app.")
break
if num_retries_attempted < num_retries:
num_retries_attempted += 1
continue
Expand Down Expand Up @@ -328,6 +330,7 @@ def wait_until_visible(driver, xpath=None, class_name=None, duration=10000, freq
driver = webdriver.Firefox(executable_path=executable_path, firefox_options=options, log_path=os.devnull)
elif args.driver_type == "chrome":
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
if args.headless:
options.add_argument("headless")
if args.webdriver_path != None:
Expand Down