From 6eb5d24f3eeb88eb041622b3cae3366729c9561f Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sat, 26 May 2018 00:09:57 +0200 Subject: [PATCH] Fix mypy issue --- utils/webfinger.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/webfinger.py b/utils/webfinger.py index 93f33df..8e6fdc7 100644 --- a/utils/webfinger.py +++ b/utils/webfinger.py @@ -52,6 +52,8 @@ def webfinger(resource: str) -> Optional[Dict[str, Any]]: def get_remote_follow_template(resource: str) -> Optional[str]: data = webfinger(resource) + if data is None: + return None for link in data['links']: if link.get('rel') == 'http://ostatus.org/schema/1.0/subscribe': return link.get('template') @@ -65,6 +67,8 @@ def get_actor_url(resource: str) -> Optional[str]: the Actor URL or None if the resolution failed. """ data = webfinger(resource) + if data is None: + return None for link in data['links']: if link.get('rel') == 'self' and link.get('type') == 'application/activity+json': return link.get('href')