mirror of
https://github.com/ihabunek/toot
synced 2025-02-03 20:57:38 +01:00
Minor tweaks
This commit is contained in:
parent
c3c640edc3
commit
882b6c4d0a
10
toot/api.py
10
toot/api.py
@ -287,15 +287,11 @@ def _timeline_generator(app, user, path, params=None):
|
|||||||
path = _get_next_path(response.headers)
|
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:
|
while path:
|
||||||
response = http.get(app, user, path, params)
|
response = http.get(app, user, path, params)
|
||||||
notification = response.json()
|
notification = response.json()
|
||||||
statuses = []
|
yield [n["status"] for n in notification if n["status"]]
|
||||||
for n in notification:
|
|
||||||
if n['status']:
|
|
||||||
statuses.append(n['status'])
|
|
||||||
yield statuses
|
|
||||||
path = _get_next_path(response.headers)
|
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 all but mentions and statuses
|
||||||
exclude_types = ["follow", "favourite", "reblog", "poll", "follow_request"]
|
exclude_types = ["follow", "favourite", "reblog", "poll", "follow_request"]
|
||||||
params = {"exclude_types[]": exclude_types, "limit": limit}
|
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):
|
def timeline_list_generator(app, user, list_id, limit=20):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user