retrieve more info on error
parent
776b142f88
commit
645503d0fe
|
@ -12,10 +12,15 @@ def get_lemmy_admins(domain):
|
|||
return [a["person"]["name"] for a in site["admins"]]
|
||||
|
||||
def get_mastodon_admins(domain):
|
||||
site = None
|
||||
try:
|
||||
site = requests.get(f"https://{domain}/api/v2/instance").json()
|
||||
return [site["contact"]["account"]["username"]]
|
||||
site = requests.get(f"https://{domain}/api/v2/instance")
|
||||
site_json = site.json()
|
||||
return [site_json["contact"]["account"]["username"]]
|
||||
except Exception as err:
|
||||
if site is not None:
|
||||
logger.warning(f"Error retrieving mastodon site info for {domain}: {err}. Request text: {site.text()}")
|
||||
else:
|
||||
logger.warning(f"Error retrieving mastodon site info for {domain}: {err}")
|
||||
raise Exception(f"Error retrieving mastodon site info for {domain}: {err}")
|
||||
|
||||
|
|
Loading…
Reference in New Issue