Fix mypy issue

This commit is contained in:
Thomas Sileo 2018-05-26 00:09:57 +02:00
parent a3267971e8
commit 6eb5d24f3e

View file

@ -52,6 +52,8 @@ def webfinger(resource: str) -> Optional[Dict[str, Any]]:
def get_remote_follow_template(resource: str) -> Optional[str]: def get_remote_follow_template(resource: str) -> Optional[str]:
data = webfinger(resource) data = webfinger(resource)
if data is None:
return None
for link in data['links']: for link in data['links']:
if link.get('rel') == 'http://ostatus.org/schema/1.0/subscribe': if link.get('rel') == 'http://ostatus.org/schema/1.0/subscribe':
return link.get('template') 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. the Actor URL or None if the resolution failed.
""" """
data = webfinger(resource) data = webfinger(resource)
if data is None:
return None
for link in data['links']: for link in data['links']:
if link.get('rel') == 'self' and link.get('type') == 'application/activity+json': if link.get('rel') == 'self' and link.get('type') == 'application/activity+json':
return link.get('href') return link.get('href')