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

Loading…
Cancel
Save