Use headless mode (don't allow manual login)

hightide
Dan Howe 5 years ago
parent a9947fb115
commit 9bb2f864e0

@ -23,6 +23,7 @@ URL = 'https://camera.uwatchit.com.au/UWatchitWebV2/User/LiveView#'
OUTPUT_DIR = 'images'
TIMEZONE = 'Australia/Sydney'
WAIT_TIME = 0.1
RECORDING_DURATION = 120
username = ''
password = ''
@ -35,7 +36,7 @@ def start_session():
"""
# Start webdriver
options = Options()
options.headless = False
options.headless = True
driver = webdriver.Firefox(options=options)
return driver
@ -75,13 +76,11 @@ def login(driver):
pss.send_keys(credentials['PASSWORD'])
btn.click()
except FileNotFoundError:
# Wait for user to log in manually
while True:
try:
driver.find_element_by_id('UserName')
time.sleep(1)
except NoSuchElementException:
break
msg = f"""Provide spectur login details either:
1. In the header of this script; or
2. In the file {credential_path}.
"""
ValueError(msg)
# Extract cookies
session = requests.Session()

Loading…
Cancel
Save