From 882b6c4d0ae21613ef76a62502363aa265e470ce Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Wed, 1 Mar 2023 07:51:07 +0100 Subject: [PATCH] Minor tweaks --- toot/api.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/toot/api.py b/toot/api.py index 84d5de1..2c8edb3 100644 --- a/toot/api.py +++ b/toot/api.py @@ -287,15 +287,11 @@ def _timeline_generator(app, user, path, params=None): path = _get_next_path(response.headers) -def _notif_timeline_generator(app, user, path, params=None): +def _notification_timeline_generator(app, user, path, params=None): while path: response = http.get(app, user, path, params) notification = response.json() - statuses = [] - for n in notification: - if n['status']: - statuses.append(n['status']) - yield statuses + yield [n["status"] for n in notification if n["status"]] path = _get_next_path(response.headers) @@ -327,7 +323,7 @@ def notification_timeline_generator(app, user, limit=20): # exclude all but mentions and statuses exclude_types = ["follow", "favourite", "reblog", "poll", "follow_request"] params = {"exclude_types[]": exclude_types, "limit": limit} - return _notif_timeline_generator(app, user, '/api/v1/notifications', params) + return _notification_timeline_generator(app, user, "/api/v1/notifications", params) def timeline_list_generator(app, user, list_id, limit=20):