Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #193 from sinun98/finalcookie
Browse files Browse the repository at this point in the history
Neuer cookie wenn Buchung/Code bestätigen fehlschlägt
  • Loading branch information
sinun98 authored May 28, 2021
2 parents 2017cac + 6289a40 commit ac0a7ff
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions tools/its.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,18 @@ def termin_buchen(self):
return True

elif res.status_code == 429:
msg = "Anfrage wurde von der Botprotection geblockt."
msg = "Anfrage wurde von der Botprotection geblockt. Cookies werden erneuert und die Buchung wiederholt."
self.log.error(msg)
self.renew_cookies_code()
res = self.s.post(self.domain + path, json=data, timeout=15)
if res.status_code == 201:
msg = "Termin erfolgreich gebucht!"
self.log.success(msg)
desktop_notification(operating_system=self.operating_system, title="Terminbuchung:", message=msg)
return True
else:
return False

elif res.status_code >= 400:
data = res.json()
try:
Expand Down Expand Up @@ -684,13 +695,17 @@ def code_bestaetigen(self, token, sms_pin):
"smspin": sms_pin

}
res = self.s.post(self.domain + path, json=data, timeout=15)
if res.ok:
self.log.success("Der Impf-Code wurde erfolgreich angefragt, bitte prüfe deine Mails!")
return True
else:
self.log.error(f"Code-Verifikation fehlgeschlagen: {res.text}")
return False
while True:
res = self.s.post(self.domain + path, json=data, timeout=15)
if res.ok:
self.log.success("Der Impf-Code wurde erfolgreich angefragt, bitte prüfe deine Mails!")
return True
elif res.status_code == 429:
self.log.error("Cookies müssen erneuert werden.")
self.renew_cookies_code()
else:
self.log.error(f"Code-Verifikation fehlgeschlagen: {res.text}")
return False

@staticmethod
def terminsuche(code: str, plz_impfzentren: list, kontakt: dict, PATH: str, check_delay: int = 30):
Expand Down

0 comments on commit ac0a7ff

Please sign in to comment.