From 3a8d84e9b1e33df2ac083282cb9f2aed29422575 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 9 May 2020 12:33:02 -0700 Subject: [PATCH] A couple bugs in loading authors --- fedireads/connectors/abstract_connector.py | 2 ++ fedireads/connectors/fedireads_connector.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fedireads/connectors/abstract_connector.py b/fedireads/connectors/abstract_connector.py index 27cd87eb9..aa36bc52f 100644 --- a/fedireads/connectors/abstract_connector.py +++ b/fedireads/connectors/abstract_connector.py @@ -198,6 +198,8 @@ def has_attr(obj, key): def get_date(date_string): ''' helper function to try to interpret dates ''' + if not date_string: + return None try: return pytz.utc.localize(parser.parse(date_string)) except ValueError: diff --git a/fedireads/connectors/fedireads_connector.py b/fedireads/connectors/fedireads_connector.py index d5cec38ec..74fe4914c 100644 --- a/fedireads/connectors/fedireads_connector.py +++ b/fedireads/connectors/fedireads_connector.py @@ -150,7 +150,12 @@ class Connector(AbstractConnector): except ObjectDoesNotExist: pass - resp = requests.get('%s/authors/%s.json' % (self.base_url, remote_id)) + resp = requests.get( + remote_id, + headers={ + 'Accept': 'application/activity+json; charset=utf-8', + }, + ) if not resp.ok: resp.raise_for_status()