Allow user to log in manually

master
Dan Howe 5 years ago
parent 63be3fbea3
commit 1517ab6084

@ -18,12 +18,12 @@ from selenium.common.exceptions import (NoSuchElementException,
WebDriverException) WebDriverException)
CAM_ID = 0 CAM_ID = 0
USERNAME = ''
PASSWORD = ''
URL = 'https://camera.uwatchit.com.au/UWatchitWebV2/User/LiveView#' 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
username = ''
password = ''
def start_session(): def start_session():
@ -52,15 +52,25 @@ def login(driver):
driver.get(URL) driver.get(URL)
# Get login fields # Login automatically if details provided
usr = driver.find_element_by_id('UserName') if username and password:
pss = driver.find_element_by_id('Password') # Get login fields
btn = driver.find_element_by_id('submitlogin') usr = driver.find_element_by_id('UserName')
pss = driver.find_element_by_id('Password')
# Input login details btn = driver.find_element_by_id('submitlogin')
usr.send_keys(USERNAME)
pss.send_keys(PASSWORD) # Input login details
btn.click() usr.send_keys(username)
pss.send_keys(password)
btn.click()
else:
# Wait for user to log in manually
while True:
try:
print(driver.find_element_by_id('UserName'))
time.sleep(1)
except NoSuchElementException:
break
# Extract cookies # Extract cookies
session = requests.Session() session = requests.Session()

Loading…
Cancel
Save