From e290f2c05f80832c42a6c282d7d16792dab80bf8 Mon Sep 17 00:00:00 2001 From: Timothy Quilling Date: Fri, 30 Jun 2023 00:11:33 -0400 Subject: [PATCH] chore: use getters --- find_posts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/find_posts.py b/find_posts.py index 8d5fb3c..22f23db 100644 --- a/find_posts.py +++ b/find_posts.py @@ -74,7 +74,7 @@ def add_user_posts(server, access_token, followings, know_followings, all_known_ count = 0 failed = 0 for post in posts: - if post['reblog'] == None and post['url'] != None and post['url'] not in seen_urls: + if post.get('reblog') is None and post.get('url') is not None and post.get('url') not in seen_urls: added = add_post_with_context(post, server, access_token, seen_urls) if added is True: seen_urls.add(post['url']) @@ -90,7 +90,7 @@ def add_post_with_context(post, server, access_token, seen_urls): added = add_context_url(post['url'], server, access_token) if added is True: seen_urls.add(post['url']) - if (post['replies_count'] or post['in_reply_to_id']) and arguments.backfill_with_context > 0: + if ('replies_count' in post or 'in_reply_to_id' in post) and getattr(arguments, 'backfill_with_context', 0) > 0: parsed_urls = {} parsed = parse_url(post['url'], parsed_urls) if parsed == None: