mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Fix mypy issue
This commit is contained in:
parent
a3267971e8
commit
6eb5d24f3e
1 changed files with 4 additions and 0 deletions
|
@ -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')
|
||||||
|
|
Loading…
Reference in a new issue