Better error when admin not set in masto
parent
ffbe028160
commit
89167cb597
|
@ -224,7 +224,7 @@ class Censures(Resource):
|
|||
)
|
||||
db.session.add(new_report)
|
||||
db.session.commit()
|
||||
logger.info(f"{instance.domain} Modfied censure for {domain}")
|
||||
logger.info(f"{instance.domain} modIfied censure for {domain}")
|
||||
return {"message":'Changed'}, 200
|
||||
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ class Hesitations(Resource):
|
|||
)
|
||||
db.session.add(new_report)
|
||||
db.session.commit()
|
||||
logger.info(f"{instance.domain} Modfied hesitation for {domain}")
|
||||
logger.info(f"{instance.domain} modIfied hesitation for {domain}")
|
||||
return {"message":'Changed'}, 200
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@ def get_mastodon_admins(domain):
|
|||
try:
|
||||
site = requests.get(f"https://{domain}/api/v2/instance")
|
||||
site_json = site.json()
|
||||
if "contact" not in site_json or "account" not in site_json["contact"] or "username" not in site_json["contact"]["account"]:
|
||||
logger.error(f"No admin contact is specified for {domain}.")
|
||||
raise Exception(f"No admin contact is specified for {domain}.")
|
||||
return [site_json["contact"]["account"]["username"]]
|
||||
except Exception as err:
|
||||
if site is not None:
|
||||
|
|
Loading…
Reference in New Issue