logging and stuff
This commit is contained in:
parent
73268b80c1
commit
69c44abf1b
2 changed files with 3 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
name: E-Paper Screenshotter
|
||||
version: 1.0.1.30
|
||||
version: 1.0.1.31
|
||||
#image: ghcr.io/maxwinterstein/homeassistant-addon-toogoodtogo-ha-mqtt-bridge-{arch}
|
||||
slug: screenshotter
|
||||
description: Screenshot images for E-Paper pricetags
|
||||
|
|
|
@ -23,7 +23,7 @@ ha_language = os.environ.get("SCREEN_HA_LANGUAGE", default="en")
|
|||
|
||||
# enable browser logging
|
||||
d = DesiredCapabilities.CHROME
|
||||
d['loggingPrefs'] = {'browser': 'ALL'}
|
||||
#d['loggingPrefs'] = {'browser': 'ALL'}
|
||||
# Open another headless browser with height extracted above
|
||||
chrome_options = ChromeOptions()
|
||||
chrome_options.add_argument("--headless")
|
||||
|
@ -62,18 +62,13 @@ while True:
|
|||
driver.implicitly_wait(10)
|
||||
|
||||
if task.get("dashboard"):
|
||||
#def interceptor(request):
|
||||
# if request.headers['Authorization']:
|
||||
# del request.headers['Authorization'] # Remember to delete the header first
|
||||
# request.headers['Authorization'] = f"Bearer {ha_token}" # Spoof the referer
|
||||
#driver.request_interceptor = interceptor
|
||||
logging.info("Doing HA Auth")
|
||||
def response_interceptor(req, response):
|
||||
response.headers['Access-Control-Allow-Origin'] = '*'
|
||||
driver.response_interceptor = response_interceptor
|
||||
|
||||
driver.get(INTERNAL_HA_URL)
|
||||
time.sleep(int(wait))
|
||||
logging.info("Doing HA Auth")
|
||||
driver.execute_script(f"window.localStorage.setItem('hassTokens', JSON.stringify({{hassUrl: '{INTERNAL_HA_URL}', access_token: '{ha_token}', token_type: 'Bearer'}}));")
|
||||
driver.get(f'{INTERNAL_HA_URL}/{task["dashboard"]}')
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue