Make Misskey fetcher survive bad JSON

merge-requests/139/head
Jason Robinson 2018-12-02 20:14:35 +02:00
rodzic 402e72d488
commit 6985a49a9a
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -38,8 +38,12 @@ def fetch_misskey_document(host: str, mastodon_document: Dict=None) -> Optional[
response = requests.post(f'https://{host}/api/meta') # ¯\_(ツ)_/¯
except Exception:
return
try:
doc = response.json()
except json.JSONDecodeError:
return
if response.status_code == 200:
return parse_misskey_document(response.json(), host, mastodon_document=mastodon_document)
return parse_misskey_document(doc, host, mastodon_document=mastodon_document)
def fetch_nodeinfo_document(host):