Mes choix de centre
This commit is contained in:
parent
4dbe697acf
commit
92a3578b2b
24
bot.py
24
bot.py
|
@ -10,9 +10,9 @@ import requests
|
||||||
import smtplib
|
import smtplib
|
||||||
|
|
||||||
|
|
||||||
# API_PREFIX = "https://beta.interieur.gouv.fr/candilib/api/v2/"
|
API_PREFIX = "https://beta.interieur.gouv.fr/candilib/api/v2/"
|
||||||
# API_PREFIX = "https://candilib.ynerant.fr/candilib/api/v2/"
|
# API_PREFIX = "https://candilib.ynerant.fr/candilib/api/v2/"
|
||||||
API_PREFIX = "http://localhost/candilib/api/v2/"
|
# API_PREFIX = "http://localhost/candilib/api/v2/"
|
||||||
|
|
||||||
CAPTCHA_IMAGES = {
|
CAPTCHA_IMAGES = {
|
||||||
"L'avion": "airplane",
|
"L'avion": "airplane",
|
||||||
|
@ -168,14 +168,15 @@ def main(token: str) -> None:
|
||||||
dpt.count += centre.count
|
dpt.count += centre.count
|
||||||
|
|
||||||
places = Places(**api('places', token, user_id))
|
places = Places(**api('places', token, user_id))
|
||||||
for dpt in departements:
|
if places.centre:
|
||||||
for centre in dpt.centres:
|
for dpt in departements:
|
||||||
if centre._id == places.centre['_id']:
|
for centre in dpt.centres:
|
||||||
places.centre = centre
|
if centre._id == places.centre['_id']:
|
||||||
break
|
places.centre = centre
|
||||||
else:
|
break
|
||||||
continue
|
else:
|
||||||
break
|
continue
|
||||||
|
break
|
||||||
|
|
||||||
if places.date:
|
if places.date:
|
||||||
print(f"Vous avez déjà une date d'examen, le {places.date}.")
|
print(f"Vous avez déjà une date d'examen, le {places.date}.")
|
||||||
|
@ -191,7 +192,8 @@ def main(token: str) -> None:
|
||||||
send_mail(json.dumps(dates, indent=2), centre.nom)
|
send_mail(json.dumps(dates, indent=2), centre.nom)
|
||||||
centre.dates = dates
|
centre.dates = dates
|
||||||
|
|
||||||
PREFERRED_CENTRES = ["MASSY", "RUNGIS", "ETAMPES", "SAINT CLOUD", "SAINT PRIEST"]
|
PREFERRED_CENTRES = ["MASSY", "ANTONY", "RUNGIS", "MONTGERON", "CLAMART", "SAINT CLOUD", "EVRY",
|
||||||
|
"VILLABE", "ETAMPES", "VELIZY VILLACOUBLAY", "MAISONS ALFORT", "TRAPPES", "SAINT PRIEST"]
|
||||||
|
|
||||||
for name in PREFERRED_CENTRES:
|
for name in PREFERRED_CENTRES:
|
||||||
for dpt in departements:
|
for dpt in departements:
|
||||||
|
|
Loading…
Reference in New Issue