|
|
|
@ -18,12 +18,12 @@ from selenium.common.exceptions import (NoSuchElementException,
|
|
|
|
|
WebDriverException)
|
|
|
|
|
|
|
|
|
|
CAM_ID = 0
|
|
|
|
|
USERNAME = ''
|
|
|
|
|
PASSWORD = ''
|
|
|
|
|
URL = 'https://camera.uwatchit.com.au/UWatchitWebV2/User/LiveView#'
|
|
|
|
|
OUTPUT_DIR = 'images'
|
|
|
|
|
TIMEZONE = 'Australia/Sydney'
|
|
|
|
|
WAIT_TIME = 0.1
|
|
|
|
|
username = ''
|
|
|
|
|
password = ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def start_session():
|
|
|
|
@ -52,15 +52,25 @@ def login(driver):
|
|
|
|
|
|
|
|
|
|
driver.get(URL)
|
|
|
|
|
|
|
|
|
|
# Login automatically if details provided
|
|
|
|
|
if username and password:
|
|
|
|
|
# Get login fields
|
|
|
|
|
usr = driver.find_element_by_id('UserName')
|
|
|
|
|
pss = driver.find_element_by_id('Password')
|
|
|
|
|
btn = driver.find_element_by_id('submitlogin')
|
|
|
|
|
|
|
|
|
|
# Input login details
|
|
|
|
|
usr.send_keys(USERNAME)
|
|
|
|
|
pss.send_keys(PASSWORD)
|
|
|
|
|
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
|
|
|
|
|
session = requests.Session()
|
|
|
|
|