From b228a91174b805fe5f490e30622df5e71d7f28b6 Mon Sep 17 00:00:00 2001 From: Lukas Date: Sat, 5 Jun 2021 23:32:02 +0200 Subject: [PATCH] add Pin page handling --- C-Impf.py | 32 +++++++++++++++++++++++++++----- README.md | 2 +- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/C-Impf.py b/C-Impf.py index 235098e..7a1f2dc 100644 --- a/C-Impf.py +++ b/C-Impf.py @@ -3,8 +3,8 @@ TBD """ __author__ = "Lukas Mahler" -__version__ = "0.0.2" -__date__ = "28.05.2021" +__version__ = "0.0.3" +__date__ = "05.06.2021" __email__ = "m@hler.eu" __status__ = "Development" @@ -70,7 +70,6 @@ def main(): init() url = 'https://353-iz.impfterminservice.de/impftermine/service?plz=20357' # test - url = 'https://226-iz.impfterminservice.de/impftermine/service?plz=22417' url = 'https://226-iz.impfterminservice.de/impftermine/service?plz=22457' chrome_driver = find_driver() @@ -129,7 +128,7 @@ def main(): element_alter.send_keys(Keys.ENTER) try: - waiting = WebDriverWait(driver, 3).until(ec.url_changes(url)) + WebDriverWait(driver, 3).until(ec.url_changes(url)) except TimeoutException: print(Fore.RED + "=> Doch keine Termine" + Style.RESET_ALL) exit() @@ -142,7 +141,30 @@ def main(): element_email.send_keys('test@test.de') element_tel = driver.find_element_by_css_selector("input[formControlName=phone]") - element_tel.send_keys('0000000000000000') + element_tel.send_keys('000000000000') + + url = driver.current_url + element_tel.send_keys(Keys.ENTER) + + try: + WebDriverWait(driver, 3).until(ec.url_changes(url)) + except TimeoutException: + print(Fore.RED + "=> Anforderung fehlgeschlagen" + Style.RESET_ALL) + exit() + + print(Fore.GREEN + "=> Buchung möglich, bitte Pin übergeben" + Style.RESET_ALL) + + # TODO + # Benachrichtigung das eine Buchung durchgeführt werden kann + # Irgendwie muss die PIN nun innerhalb von 10 Minuten vom Handy zur Website + pin = input("Bitte Pin eingeben: ") + + element_pin = WebDriverWait(driver, 10).until( + ec.presence_of_element_located( + (By.CSS_SELECTOR, "input[formControlName=pin]") + ) + ) + element_pin.send_keys(pin) # Wait Hack, delete on production input() diff --git a/README.md b/README.md index 677fcdc..09f7cd0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # C-Impf -Corona Impfung Polling Agent \ No newline at end of file +Corona Impfung Autobuchung für DE HH \ No newline at end of file