Skip to content

Commit

Permalink
fix(code-gen): code generation with selenium, GUI fixes (#491)
Browse files Browse the repository at this point in the history
* feat(search): Wenn angebracht, pausiere Vermittlungscodes (#431)

* fix(Kontaktdaten GUI): fix for pressing Cancel Btn in Kontaktdaten GUI raised error (#436)

* Fix for pressing Cancel Btn in Kontaktdaten GUI raised error

Hier wie man es replizieren kann:
Kontaktdaten.json ist nicht vorhanden
Termin suchen drücken
Kontakdaten ausfüllen kommt
"Abbrechen"
Falsche/Unnötige Fehlermeldung da ja abgebrochen kommtHier wie man es replizieren kann:
Kontaktdaten.json ist nicht vorhanden
Termin suchen drücken
Kontakdaten ausfüllen kommt
"Abbrechen"
Falsche/Unnötige Fehlermeldung da ja abgebrochen kommt

@Floskinner  passt das so?

* Docstring added

* syntax change

* Revert "syntax change"

This reverts commit a6d16c9.

* syntax fix

* Fix for reject() / accept()

Buttons  wurden nicht korrekt zurück gemeldet.

@Floskinner

* fix(gender): added Kind and Divers as gender options (#442)

* Added Kind and Divers (#448)

* feat(code gen GUI): Added 3 retries of SMS PIN (if attempt failed) (#432)

* fix(log): Ensure tools/log paths are constructed portably (#454)

On Linux, the backslash in "tools\log\" was not interpreted as path
separator, so screenshots etc. ended up in the project's root directory,
named "tools\log\<filename>". Now they are named "<filename>" and stored
in the log-directory under tools.

* Don't throw and show error if loading of data was cancelled by the user (#456)

Co-authored-by: Juri <j.robl@osram.com>

* feat(GUI): Sprachsupport, Usability (#455)

* Update .gitignore

Added venv

* Documentation

* added language support and minor improvements

* documentation

* Updated .gitignore

* Update .gitignore

Added venv

Documentation

added language support and minor improvements

documentation

Updated .gitignore

* typos

* Adapt postition zip-code hometown

* fix(cookie-gen): Improve cookie generation / enter v-code with updated mouse simulation (#453)

* Improve mouse simulation for cookies / enter code

* Add requirements for mouse simulation

* Remove unecessary import

* Fix imports

* Remove imports which doesnt work on M1

* Generate coordinates without numpy/scipy

* Update move mouse by offsets func

* Add func to move from source x,y to target x,y

* Improve enter vermittlungscode

* Add mouse movements to driver_enter_code()

* Add second try if "Es ist ein unerwarteter Fehler aufgetreten" occurs

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Fix ugly if

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Update tools/its.py

Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

Co-authored-by: Jonas Mock <jonasmock97@gmail.com>
Co-authored-by: Tim Reibe <38082956+iamnotturner@users.noreply.github.com>

* Added a minimum of 30 seconds for retry-sec/check-delay (#452)

* refactor(search): Rotiere durch PLZs, anstatt Zufallswahl (#444)

* feat(notify): added notification configuration to GUI (#463)

* added notifications to GUI

* added tabstops

* Update tools/gui/qtkontakt.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Workaround für Generierung von Vermittlungscodes (#459)

* Update requirements

* Replace code_anfordern()

* Fix wait for server response before continue

* Accept cookies

* Add queue bypass

* Add retry counter for fetching server response

* Revert from HEAD to 7efe793.

* Add selenium_code_anfordern()

* Replace its.code_anfordern()

* Add logging

* Add specific error messages

* Add mouse simulation

* Enter char by char

* Fix random v-code

Co-authored-by: Jonas Mock <jonasmock97@gmail.com>

* fix(bugs): small bugfixes, added selenium debugging port (#466)

* fix(notifications GUI): Fix for KeyError "notifications" after click Kontaktdaten bearbeiten over GUI (#468)

* Draft for Code gen over GUI

first draft for running Code Gen over GUI

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update qtcodegen.py

* Thread cancel optimization

break while loops if stop called

* update now checking missing kontakt data

showing dialog to generate kontaktdaten if not present

* remove help icon

* added  CodeGEn Checkbox to Kontaktdaten

for now it just simply adds a XXXX dummy code to prevent code validation error (since it is not yet known )

* Update qtcodegen.py

* Update qtcodegen.py

* Revert "added  CodeGEn Checkbox to Kontaktdaten"

This reverts commit 3bf7b6f.

* added QtCodeGen to SubProcess

added QtCodeGen to SubProcess  because Impfterminservice is blocking  the Thread for termination

* adapted to mainline beta and further improvements

READY to TEST

* Update main.py

* Update utils.py

* Update qtcodegen.py

hard exit if cancelled

* Revert "Update main.py"

This reverts commit 8f082c5.

* file permission fix

git update-index --chmod=+x main.py under windows

* File permissin change revert

* Update gui.py

small rearrangment

* Update tools/gui/qtcodegen.py

THX

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* keep all data kontaktdaten.json and just set a dummy code for code gen task

Rework to keep all data in kontaktdaten.json and just set a dummy code for code gen task if not file is present.

Also added checks if kontaktdaten edit fenster was cancelled to not run processes.

Also do a full validation check on input also if mode CODE_GENERIEREN, to have a valid config file

* Update gui.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update gui.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update qtkontakt.py

changes from @Floskinner  added

* Revert "Merge branch 'beta' into ownBeta"

This reverts commit cb67518, reversing
changes made to 7e719ec.

* Revert "Revert "Merge branch 'beta' into ownBeta""

This reverts commit fe4d9f5.

* logger conflicts with redirect of qtgui

* added fix from TIm Reibe

* Added 3 Input Dlg retries if SMS PIN  was wrong

Change allows a wrong input of smspin and if code failed to accept the pin will be asked again

* Fix for keyerror in GUI (Kontaktdaten bearbeiten) with old file

tools\gui\qtkontakt.py", line 362, in __lade_alle_werte
    if kontaktdaten['notifications']:
KeyError: 'notifications'

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* fix missing add-data in create spec for version.txt

* selenium-wire hooks for pyinstaller

* feat(notifications): Fire notification as soon as an appointment was found (#474)

* Added title to telegram notification message

* Fire notification as soon as an appointment was found

* Added possibility to move the mouse negative values (#458)

* Added possibility to move the mouse negative values

* - Refactored, moved mouse movement and path generation to own file mousemover.py

* - Reordered imports

* - Fix calls to move_mouse_to_coordinates

Co-authored-by: Juri <j.robl@osram.com>

* feat(GUI): Verbesserte Oberfläche im Modus CODE_GENERIEREN  (#471)

* Update .gitignore

Added venv

* Improved Kontaktdateneingabe (CodeGen))

Verbesserung der UX.
Felder wurden deaktiviert,
Ladefunktion unterstüzt nun CodeGen

* select correct tab

* typo

* added default arguments

* Improve selenium vcode generation (#480)

* Add second try if "Es ist ein unerwarteter Fehler aufgetreten"

* Improve selenium_code_anfordern

* Close browser if error occurs

* Fixed unable to locate element

* Fix unable to locate element #2

* Fix 'CLogger' object has no attribute 'warning'

* Prevent unable locate sms_verifizierung_h1 after successful request

* Cleaned up main

Co-authored-by: Jonas Mock <jonasmock97@gmail.com>

* fix(seleniumwire): added chrome_options to selenium-wire, added selenium-wire certificates (#485)

* added chrome_options to seleniumwire, pep8 changes

* added seleniumwire certificates

* fix(PR #480 crahsed GUI): added selenium code generation to GUI (#486)

* Draft for Code gen over GUI

first draft for running Code Gen over GUI

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update qtcodegen.py

* Thread cancel optimization

break while loops if stop called

* update now checking missing kontakt data

showing dialog to generate kontaktdaten if not present

* remove help icon

* added  CodeGEn Checkbox to Kontaktdaten

for now it just simply adds a XXXX dummy code to prevent code validation error (since it is not yet known )

* Update qtcodegen.py

* Update qtcodegen.py

* Revert "added  CodeGEn Checkbox to Kontaktdaten"

This reverts commit 3bf7b6f.

* added QtCodeGen to SubProcess

added QtCodeGen to SubProcess  because Impfterminservice is blocking  the Thread for termination

* adapted to mainline beta and further improvements

READY to TEST

* Update main.py

* Update utils.py

* Update qtcodegen.py

hard exit if cancelled

* Revert "Update main.py"

This reverts commit 8f082c5.

* file permission fix

git update-index --chmod=+x main.py under windows

* File permissin change revert

* Update gui.py

small rearrangment

* Update tools/gui/qtcodegen.py

THX

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* keep all data kontaktdaten.json and just set a dummy code for code gen task

Rework to keep all data in kontaktdaten.json and just set a dummy code for code gen task if not file is present.

Also added checks if kontaktdaten edit fenster was cancelled to not run processes.

Also do a full validation check on input also if mode CODE_GENERIEREN, to have a valid config file

* Update gui.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update gui.py

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* Update qtkontakt.py

changes from @Floskinner  added

* Revert "Merge branch 'beta' into ownBeta"

This reverts commit cb67518, reversing
changes made to 7e719ec.

* Revert "Revert "Merge branch 'beta' into ownBeta""

This reverts commit fe4d9f5.

* logger conflicts with redirect of qtgui

* added fix from TIm Reibe

* Added 3 Input Dlg retries if SMS PIN  was wrong

Change allows a wrong input of smspin and if code failed to accept the pin will be asked again

* Fix for keyerror in GUI (Kontaktdaten bearbeiten) with old file

tools\gui\qtkontakt.py", line 362, in __lade_alle_werte
    if kontaktdaten['notifications']:
KeyError: 'notifications'

* fix(PR #480 crahsed GUI)

Merged changes to GUI from : #480

Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>

* bugfix notifications not working in GUI (#487)

* fix(master): merge master into beta (#490)

* Update README.md

* Update README.md

* Create CONTRIBUTING.md

* Update README.md

* Update CONTRIBUTING.md

* Added Kind and Divers (#437)

Kind and Divers are now also selectable ,)

* Revert "Added Kind and Divers (#437)" (#443)

This reverts commit 996878c.

* Update README.md

Co-authored-by: Julius Jacobitz <47418007+JuliusJacobitz@users.noreply.github.com>
Co-authored-by: IAmWebSA <webmaster@zutroll.de>

Co-authored-by: haslersn <sebastian.hasler@gmx.net>
Co-authored-by: IAmWebSA <webmaster@zutroll.de>
Co-authored-by: Andreas Wachowski <andreas.wachowski@gmail.com>
Co-authored-by: Genmutant <github@jurirobl.de>
Co-authored-by: Juri <j.robl@osram.com>
Co-authored-by: Alex <a.suhrkamp@gmx.de>
Co-authored-by: Jonas Mock <info@jonasmock.de>
Co-authored-by: Jonas Mock <jonasmock97@gmail.com>
Co-authored-by: Timo <43381667+pancakeDevelopment@users.noreply.github.com>
Co-authored-by: Marco Rombach <36333308+marcorombach@users.noreply.github.com>
Co-authored-by: Florian Glaser <58706771+Floskinner@users.noreply.github.com>
Co-authored-by: JuliusJacobitz <julius@jacobitz.de>
Co-authored-by: Julius Jacobitz <47418007+JuliusJacobitz@users.noreply.github.com>
Co-authored-by: Sebastian Nagel <nagels@informatik.uni-tuebingen.de>
  • Loading branch information
15 people committed Jun 16, 2021
1 parent efab415 commit 5b79c7e
Show file tree
Hide file tree
Showing 19 changed files with 1,208 additions and 227 deletions.
4 changes: 2 additions & 2 deletions .gitignore
@@ -1,15 +1,15 @@
.idea/
.vscode/
__pycache__/
venv/

*.DS_Store

# log
log/

# data
kontaktdaten.json
zeitspanne.json
data/*.json

#building:
installer/
Expand Down
8 changes: 4 additions & 4 deletions docs/distribution.md
Expand Up @@ -56,22 +56,22 @@ Schritte zum Erstellen einer Distribution:

.spec Datei erstellen und anschließend Distribution erstellen:
```shell
pyi-makespec main.py --specpath "specs//" --add-binary "..\tools\chromedriver\chromedriver-windows.exe;tools\chromedriver\" --name windows-terminservice --hidden-import plyer.platforms.win.notification --hidden-import cloudscraper --add-data "../tools/cloudscraper;./cloudscraper/" --icon "..images\spritze.ico"
pyi-makespec main.py --specpath "specs//" --add-binary "..\tools\chromedriver\chromedriver-windows.exe;tools\chromedriver\" --name windows-terminservice --hidden-import plyer.platforms.win.notification --hidden-import cloudscraper --add-data "../tools/cloudscraper;./cloudscraper/" --icon "..\images\spritze.ico" --add-data "../version.txt;." --additional-hooks-dir "../tools/additional_hooks"
pyinstaller --clean specs/windows-terminservice.spec
```
#### Windows GUI
```shell
pyi-makespec gui.py --specpath "specs//" --add-binary "..\tools\chromedriver\chromedriver-windows.exe;tools\chromedriver\" --add-binary "..\tools\gui\kontaktdaten.ui;tools\gui\" --add-binary "..\tools\gui\main.ui;tools\gui\" --add-binary "..\tools\gui\terminsuche.ui;tools\gui\" --add-binary "..\tools\gui\uhrzeiten.ui;tools\gui\" --add-binary "..\tools\gui\ui_qtcodegen.ui;tools\gui\" --add-binary "..\images\spritze.ico;images\" --name windows-terminservice-gui --hidden-import plyer.platforms.win.notification --hidden-import cloudscraper --add-data "../tools/cloudscraper;./cloudscraper/" --icon "..\images\spritze.ico" --windowed
pyi-makespec gui.py --specpath "specs//" --add-binary "..\tools\chromedriver\chromedriver-windows.exe;tools\chromedriver\" --add-binary "..\tools\gui\kontaktdaten.ui;tools\gui\" --add-binary "..\tools\gui\main.ui;tools\gui\" --add-binary "..\tools\gui\terminsuche.ui;tools\gui\" --add-binary "..\tools\gui\impfzentren.ui;tools\gui\" --add-binary "..\tools\gui\ui_qtcodegen.ui;tools\gui\" --add-binary "..\images\spritze.ico;images\" --name windows-terminservice-gui --hidden-import plyer.platforms.win.notification --hidden-import cloudscraper --add-data "../tools/cloudscraper;./cloudscraper/" --icon "..\images\spritze.ico" --windowed --add-data "../version.txt;." --additional-hooks-dir "../tools/additional_hooks"

pyinstaller --clean specs/windows-terminservice-gui.spec
```

#### Linux
```shell
pyi-makespec main.py --specpath "specs//" --add-binary "../tools/chromedriver/chromedriver-linux-64:tools/chromedriver/" --name linux-64-terminservice --hidden-import cloudscraper --add-data "../tools/cloudscraper;./cloudscraper/" --icon "..images\spritze.ico"

pyi-makespec main.py --specpath "specs//" --add-binary "../tools/chromedriver/chromedriver-linux-64:tools/chromedriver/" --name linux-64-terminservice --hidden-import cloudscraper --add-data "../tools/cloudscraper;./cloudscraper/" --icon "..images\spritze.ico" --add-data "../version.txt:." --additional-hooks-dir "../tools/additional_hooks"
pyinstaller --clean specs/linux-64-terminservice.spec

```
Expand Down
28 changes: 23 additions & 5 deletions gui.py
Expand Up @@ -59,7 +59,6 @@ def __init__(self, pfad_fenster_layout: str = os.path.join(PATH, "tools/gui/main

# Laden der .ui Datei und Anpassungen
self.setup(pfad_fenster_layout)


# GUI anzeigen
self.show()
Expand All @@ -82,6 +81,14 @@ def start_gui():

app = QtWidgets.QApplication(list())
app.setAttribute(QtCore.Qt.AA_X11InitThreads)

# Lade Systemsprache und passende Übersetzungen
sys_lang = QtCore.QLocale.system()
translator = QtCore.QTranslator()
if translator.load(sys_lang, "qtbase", "_", QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)):
app.installTranslator(translator)


window = HauptGUI()
app.exec_()

Expand Down Expand Up @@ -254,8 +261,10 @@ def __start_terminsuche(self, kontaktdaten: dict, zeitrahmen: dict):

check_delay = self.i_interval.value()
codes = kontaktdaten["codes"]
notifications = kontaktdaten.get("notifications", {})
terminsuche_prozess = multiprocessing.Process(target=QtTerminsuche.start_suche, name=f"{codes[0]}-{self.prozesse_counter}", daemon=True, kwargs={
"kontaktdaten": kontaktdaten,
"notifications": notifications,
"zeitrahmen": zeitrahmen,
"ROOT_PATH": PATH,
"check_delay": check_delay})
Expand Down Expand Up @@ -294,6 +303,9 @@ def __update_kontaktdaten_pfad(self, pfad: str):
except FileNotFoundError:
return

if pfad is None:
return

self.pfad_kontaktdaten = pfad
self.i_kontaktdaten_pfad.setText(self.pfad_kontaktdaten)

Expand Down Expand Up @@ -378,18 +390,24 @@ def __check_old_kontakt_version(self, kontaktdaten: dict = None) -> bool:
# Kontaktdaten #
##############################

def kontaktdaten_erstellen(self, modus: Modus = Modus.TERMIN_SUCHEN):
def kontaktdaten_erstellen(self, modus: Modus = Modus.TERMIN_SUCHEN) -> bool:
"""
Ruft den Dialog für die Kontaktdaten auf
Args:
modus (Modus): Abhängig vom Modus werden nicht alle Daten benötigt. Defalut TERMIN_SUCHEN
Returns:
bool: True bei Erfolg, False bei Abbruch
"""

dialog = QtKontakt(self, modus, self.pfad_kontaktdaten, PATH)
dialog.update_path.connect(self.__update_kontaktdaten_pfad)
dialog.show()
dialog.exec_()
if dialog.exec_() == QtWidgets.QDialog.Rejected:
return False
else:
return True

def __get_kontaktdaten(self, modus: Modus) -> dict:
"""
Expand All @@ -401,9 +419,9 @@ def __get_kontaktdaten(self, modus: Modus) -> dict:
Returns:
dict: Kontakdaten
"""

if not os.path.isfile(self.pfad_kontaktdaten):
self.kontaktdaten_erstellen(modus)
if not self.kontaktdaten_erstellen(modus):
return {}

kontaktdaten = kontak_tools.get_kontaktdaten(self.pfad_kontaktdaten)
kontak_tools.check_kontaktdaten(kontaktdaten, modus)
Expand Down
26 changes: 7 additions & 19 deletions main.py
Expand Up @@ -74,7 +74,7 @@ def update_kontaktdaten_interactive(

if "anrede" not in kontaktdaten["kontakt"] and command == "search":
input_kontaktdaten_key(
kontaktdaten, ["kontakt", "anrede"], "> Anrede (Frau/Herr/...): ")
kontaktdaten, ["kontakt", "anrede"], "> Anrede (Frau/Herr/Kind/Divers): ")

if "vorname" not in kontaktdaten["kontakt"] and command == "search":
input_kontaktdaten_key(
Expand Down Expand Up @@ -378,30 +378,15 @@ def gen_code(kontaktdaten):
print("Das Datum entspricht nicht dem richtigen Format (DD.MM.YYYY). "
"Bitte erneut versuchen.")

print()
# code anfordern
# code anfordern via selenium
try:
token, cookies = its.code_anfordern(
mail, telefonnummer, plz_impfzentrum, geburtsdatum)
if its.selenium_code_anfordern(mail, telefonnummer, plz_impfzentrum, geburtsdatum):
return True
except RuntimeError as exc:
print(
f"\nDie Code-Generierung war leider nicht erfolgreich:\n{str(exc)}")
return False

# code bestätigen
print("\nDu erhältst gleich eine SMS mit einem Code zur Bestätigung deiner Telefonnummer.\n"
"Trage diesen hier ein. Solltest du dich vertippen, hast du noch 2 weitere Versuche.\n"
"Beispiel: 123-456")

# 3 Versuche für die SMS-Code-Eingabe
for _ in range(3):
sms_pin = input("\n> SMS-Code: ").replace("-", "")
print()
if its.code_bestaetigen(token, cookies, sms_pin, plz_impfzentrum):
print("\nDu kannst jetzt mit der Terminsuche fortfahren.")
return True
print("\nSMS-Code ungültig")

print("Die Code-Generierung war leider nicht erfolgreich.")
return False

Expand Down Expand Up @@ -566,6 +551,9 @@ def main():
f"--read-only {'de' if not args.read_only else ''}aktiviert.")
elif extended_settings and option == "s":
args.retry_sec = int(input("> --retry-sec="))
if args.retry_sec<30:
print("[RETRY-SEC] Um die Server nicht übermäßig zu belasten, wurde der Wert auf 30 Sekunden gesetzt")
args.retry_sec = 30
elif extended_settings and option == "n":
new_args = copy.copy(args)
new_args.configure_notifications = not new_args.configure_notifications
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Expand Up @@ -10,4 +10,5 @@ PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.9.0
requests>=2.25.1
tqdm>=4.61.0
tqdm>=4.61.0
selenium-wire>=4.3.1
4 changes: 2 additions & 2 deletions specs/linux-64-terminservice.spec
Expand Up @@ -6,9 +6,9 @@ block_cipher = None
a = Analysis(['../main.py'],
pathex=['./specs'],
binaries=[('../tools/chromedriver/chromedriver-linux-64', 'tools/chromedriver/')],
datas=[('../tools/cloudscraper', './cloudscraper/'), ('../version.txt', '.')],
datas=[('../tools/cloudscraper', './cloudscraper/'), ('../tools/seleniumwire', './seleniumwire/'), ('../version.txt', '.')],
hiddenimports=['cloudscraper'],
hookspath=[],
hookspath=['../tools/additional_hooks'],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
Expand Down
4 changes: 2 additions & 2 deletions specs/windows-terminservice-gui.spec
Expand Up @@ -7,9 +7,9 @@ block_cipher = None
a = Analysis(['..\\gui.py'],
pathex=['specs//'],
binaries=[('..\\tools\\chromedriver\\chromedriver-windows.exe', 'tools\\chromedriver\\'), ('..\\tools\\gui\\kontaktdaten.ui', 'tools\\gui\\'), ('..\\tools\\gui\\main.ui', 'tools\\gui\\'), ('..\\tools\\gui\\terminsuche.ui', 'tools\\gui\\'), ('..\\tools\\gui\\impfzentren.ui', 'tools\\gui\\'), ('..\\tools\\gui\\ui_qtcodegen.ui', 'tools\\gui\\'), ('..\\images\\spritze.ico', 'images\\')],
datas=[('../tools/cloudscraper', './cloudscraper/'), ('../version.txt', '.')],
datas=[('../tools/cloudscraper', './cloudscraper/'), ('../tools/seleniumwire', './seleniumwire/'), ('../version.txt', '.')],
hiddenimports=['plyer.platforms.win.notification', 'cloudscraper'],
hookspath=[],
hookspath=['../tools/additional_hooks'],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
Expand Down
9 changes: 6 additions & 3 deletions specs/windows-terminservice.spec
@@ -1,15 +1,18 @@
# -*- mode: python ; coding: utf-8 -*-

"""
IMPORTANT:
PLEASE UPDATE docs/distribution.md too!
"""

block_cipher = None


a = Analysis(['..\\main.py'],
pathex=['specs//'],
binaries=[('..\\tools\\chromedriver\\chromedriver-windows.exe', 'tools\\chromedriver\\')],
datas=[('../tools/cloudscraper', './cloudscraper/'), ('../version.txt', '.')],
datas=[('../tools/cloudscraper', './cloudscraper/'), ('../tools/seleniumwire', './seleniumwire/'), ('../version.txt', '.')],
hiddenimports=['plyer.platforms.win.notification', 'cloudscraper'],
hookspath=[],
hookspath=['../tools/additional_hooks'],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
Expand Down
11 changes: 11 additions & 0 deletions tools/additional_hooks/hook-seleniumwire.py
@@ -0,0 +1,11 @@
"""
This is a needed workaround for pyinstaller missing out on seleniumwire.
GitHub issue comnment: https://github.com/wkeeling/selenium-wire/issues/84#issuecomment-624389859
Pyinstaller docu: https://pyinstaller.readthedocs.io/en/stable/hooks.html#providing-pyinstaller-hooks-with-your-package
"""

from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('seleniumwire')
6 changes: 5 additions & 1 deletion tools/gui/__init__.py
@@ -1,6 +1,7 @@
import os
import json
import platform
from typing import Optional

from PyQt5 import QtWidgets, uic
from PyQt5.QtWidgets import QMessageBox
Expand Down Expand Up @@ -41,7 +42,7 @@ def oeffne_file_dialog_save(parent_widged: QtWidgets.QWidget, titel: str, standa
return dateipfad


def oeffne_file_dialog_select(parent_widged: QtWidgets.QWidget, titel: str, standard_oeffnungspfad: str, dateityp="JSON Files (*.json)") -> str:
def oeffne_file_dialog_select(parent_widged: QtWidgets.QWidget, titel: str, standard_oeffnungspfad: str, dateityp="JSON Files (*.json)") -> Optional[str]:
"""
Öffnet einen File Dialog um eine existierende Datei auszuwählen
Expand All @@ -65,6 +66,9 @@ def oeffne_file_dialog_select(parent_widged: QtWidgets.QWidget, titel: str, stan
options |= QtWidgets.QFileDialog.DontUseNativeDialog

datei_data = QtWidgets.QFileDialog.getOpenFileName(parent=parent_widged, caption=titel, directory=standard_oeffnungspfad, filter=dateityp, options=options)
# Open dialog wurde abgebrochen
if datei_data == ('', ''):
return None
dateipfad = datei_data[0] # (pfad, typ)

dateipfad = dateipfad.replace("/", os.path.sep)
Expand Down

0 comments on commit 5b79c7e

Please sign in to comment.