Moins de verbosité si pas de dates
This commit is contained in:
parent
92a3578b2b
commit
1b2fd576b7
8
bot.py
8
bot.py
|
@ -146,6 +146,7 @@ def main(token: str) -> None:
|
|||
|
||||
me = Candidat(**api('me', token, user_id)['candidat'])
|
||||
print(f'Salut {me.prenom} {me.nomNaissance} !')
|
||||
print(f"Tu as accès aux places à {me.visibilityHour}.")
|
||||
|
||||
|
||||
departements = [Departement(**dpt) for dpt in api('departements', token, user_id)['geoDepartementsInfos']]
|
||||
|
@ -184,16 +185,17 @@ def main(token: str) -> None:
|
|||
|
||||
print("\n")
|
||||
for dpt in departements:
|
||||
print(dpt.geoDepartement, dpt.count)
|
||||
print(dpt.geoDepartement, dpt.count, '(' + ', '.join(centre.nom for centre in dpt.centres) + ')')
|
||||
|
||||
for dpt in departements:
|
||||
for centre in dpt.centres:
|
||||
dates = api(f"places?begin=2021-04-26T00:00:00.000&end=2021-07-31T23:59:59.999+02:00&geoDepartement={dpt.geoDepartement}&nomCentre={centre.nom}", token, user_id)
|
||||
if dates:
|
||||
send_mail(json.dumps(dates, indent=2), centre.nom)
|
||||
centre.dates = dates
|
||||
|
||||
PREFERRED_CENTRES = ["MASSY", "ANTONY", "RUNGIS", "MONTGERON", "CLAMART", "SAINT CLOUD", "EVRY",
|
||||
"VILLABE", "ETAMPES", "VELIZY VILLACOUBLAY", "MAISONS ALFORT", "TRAPPES", "SAINT PRIEST"]
|
||||
"VILLABE", "ETAMPES", "VELIZY VILLACOUBLAY", "MAISONS ALFORT", "TRAPPES"]
|
||||
|
||||
for name in PREFERRED_CENTRES:
|
||||
for dpt in departements:
|
||||
|
@ -204,7 +206,7 @@ def main(token: str) -> None:
|
|||
continue
|
||||
break
|
||||
for date in centre.dates:
|
||||
if name == "SAINT PRIEST" and ("T07:" in date or "T08:" in date):
|
||||
if name == "SAINT PRIEST" and ("T07:" in date or "T08:" in date or "T09:" in date or "T10:" in date):
|
||||
continue
|
||||
break
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue