From 4e5c2b1f9abde77498a4bb17072589dea69b930c Mon Sep 17 00:00:00 2001 From: codl Date: Thu, 21 Sep 2017 06:50:01 +0200 Subject: [PATCH] protect against invalid posts (???) i dont quite understand why i have to do this but some server is throwing posts at me without an id or a status or much of anything so.. --- libforget/mastodon.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libforget/mastodon.py b/libforget/mastodon.py index cfce59b..df29448 100644 --- a/libforget/mastodon.py +++ b/libforget/mastodon.py @@ -128,6 +128,8 @@ def fetch_acc(acc, cursor=None): kwargs['max_id'] = +inf for status in statuses: + if 'id' not in status.keys(): + continue post = post_from_api_object(status, acc.mastodon_instance) db.session.merge(post) kwargs['max_id'] = min(kwargs['max_id'], status['id'])