diff --git a/papi/main.py b/papi/main.py index 4d2a695..cb47931 100644 --- a/papi/main.py +++ b/papi/main.py @@ -65,7 +65,6 @@ class Notifier: "status": ["Le monitoring est inacessible"], } ) - breakpoint() Notifier = Notifier() @@ -108,11 +107,11 @@ def list_notification(idsonde: str): @app.get("/notifications/{idsonde}/text") def list_notification_as_text(request: Request, idsonde: str): - notifs = notifications[idsonde] + notifs = notifications[idsonde] try: - content =notifs[-1] + content = notifs[-1] except IndexError: - return + return try: recipients = sondeid2notifsemails(idsonde) except KeyError: @@ -232,9 +231,10 @@ def list_notification_as_text( if message.endswith(k): return "color: %s;" % v return "" + if not (sonde := crud.get_sonde(db, idsonde)): return - mesures = [x for x in crud.get_mesure(db, sonde.sonde_id, only_last=100)] + mesures = [x for x in crud.get_mesure(db, sonde.sonde_id, only_last=100)] res = []