Add webfinger support for the lookup, fix forwarding

This commit is contained in:
Thomas Sileo
2018-07-21 11:41:49 +02:00
parent f05eb559f0
commit 4a22ac12a8
4 changed files with 61 additions and 5 deletions

View File

@@ -3,10 +3,16 @@ import json
import little_boxes.activitypub as ap
import mf2py
import requests
from little_boxes.webfinger import get_actor_url
def lookup(url: str) -> ap.BaseActivity:
"""Try to find an AP object related to the given URL."""
try:
return ap.fetch_remote_activity(get_actor_url(url))
except Exception:
pass
backend = ap.get_backend()
resp = requests.get(
url,