mirror of
https://github.com/Rushilwiz/auto-mdh.git
synced 2025-04-09 23:00:18 -04:00
chore: updated gitignore and work
This commit is contained in:
parent
9a4804ecd0
commit
c60c457b3e
8
mdh.py
8
mdh.py
|
@ -1,14 +1,14 @@
|
||||||
from playwright.sync_api import Playwright, sync_playwright, expect
|
from playwright.sync_api import Playwright, sync_playwright, expect
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from secrets import PASSWORD, EMAIL, LOCATION
|
from secrets import PASSWORD, EMAIL, LOCATION, DEBUG
|
||||||
|
|
||||||
def start_shift(playwright: Playwright, end_hour: str, end_minute: str) -> None:
|
def start_shift(playwright: Playwright, end_hour: str, end_minute: str) -> None:
|
||||||
before_noon = int(end_hour) < 12
|
before_noon = int(end_hour) < 12
|
||||||
if int(end_hour) > 12:
|
if int(end_hour) > 12:
|
||||||
end_hour = str(int(end_hour) - 12)
|
end_hour = str(int(end_hour) - 12)
|
||||||
|
|
||||||
browser = playwright.chromium.launch(headless=False)
|
browser = playwright.chromium.launch(headless=DEBUG)
|
||||||
context = browser.new_context()
|
context = browser.new_context()
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
page.goto("https://beta.mydigitalhand.org/")
|
page.goto("https://beta.mydigitalhand.org/")
|
||||||
|
@ -56,7 +56,7 @@ def start_shift(playwright: Playwright, end_hour: str, end_minute: str) -> None:
|
||||||
browser.close()
|
browser.close()
|
||||||
|
|
||||||
def end_shift(playwright: Playwright) -> None:
|
def end_shift(playwright: Playwright) -> None:
|
||||||
browser = playwright.chromium.launch(headless=False)
|
browser = playwright.chromium.launch(headless=DEBUG)
|
||||||
context = browser.new_context()
|
context = browser.new_context()
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
page.goto("https://beta.mydigitalhand.org/")
|
page.goto("https://beta.mydigitalhand.org/")
|
||||||
|
@ -102,4 +102,4 @@ if __name__ == "__main__":
|
||||||
end_minutes = int(end_hour) * 60 + int(end_minute)
|
end_minutes = int(end_hour) * 60 + int(end_minute)
|
||||||
|
|
||||||
if day == now.weekday() and start_minutes <= now.hour * 60 + now.minute <= end_minutes:
|
if day == now.weekday() and start_minutes <= now.hour * 60 + now.minute <= end_minutes:
|
||||||
start_shift(playwright, end_hour, end_minute)
|
start_shift(playwright, end_hour, end_minute)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
EMAIL=
|
EMAIL=
|
||||||
PASSWORD=
|
PASSWORD=
|
||||||
LOCATION=
|
LOCATION=
|
||||||
|
DEBUG=True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user