From 8ee414c83af2a0715b0c24b5b920c9260d40ad3f Mon Sep 17 00:00:00 2001 From: Daniel Schwarz Date: Fri, 24 Feb 2023 22:51:27 -0500 Subject: [PATCH] Make _notif_timeline_generator more robust Notifications without statuses shouldn't crash --- toot/api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/toot/api.py b/toot/api.py index c0bdfd5..84d5de1 100644 --- a/toot/api.py +++ b/toot/api.py @@ -290,8 +290,11 @@ def _timeline_generator(app, user, path, params=None): def _notif_timeline_generator(app, user, path, params=None): while path: response = http.get(app, user, path, params) - notif = response.json() - statuses = [n['status'] for n in notif] + notification = response.json() + statuses = [] + for n in notification: + if n['status']: + statuses.append(n['status']) yield statuses path = _get_next_path(response.headers)