From: Roland Häder Date: Sun, 21 May 2023 23:57:02 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=26b9971de5f877c3070983725ec37c7fa65c357c;p=fba.git Continued: - nicer look - tidy up software, too --- diff --git a/fba.py b/fba.py index 6c86916..5c13864 100644 --- a/fba.py +++ b/fba.py @@ -179,8 +179,10 @@ def determine_software(domain: str) -> str: software = "misskey" else: # NOISY-DEBUG: print("DEBUG: Using name:", domain, json["software"]["name"]) - software = json["software"]["name"].lower() + software = tidyup(json["software"]["name"].lower()) + if software == "": + software = None except: print("WARNING: Could not determine software type:", domain) @@ -412,19 +414,19 @@ def get_misskey_blocks(domain: str) -> dict: if counter == 0: # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter) doc = post_json_api(domain, "/api/federation/instances/", json.dumps({ - "sort": "+caughtAt", - "host": None, + "sort" : "+caughtAt", + "host" : None, "suspended": True, - "limit": step + "limit" : step })) else: # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter) doc = post_json_api(domain, "/api/federation/instances/", json.dumps({ - "sort": "+caughtAt", - "host": None, + "sort" : "+caughtAt", + "host" : None, "suspended": True, - "limit": step, - "offset": counter-1 + "limit" : step, + "offset" : counter-1 })) # NOISY-DEBUG: print("DEBUG: doc():", len(doc)) @@ -461,19 +463,19 @@ def get_misskey_blocks(domain: str) -> dict: if counter == 0: # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter) doc = post_json_api(domain,"/api/federation/instances", json.dumps({ - "sort": "+caughtAt", - "host": None, + "sort" : "+caughtAt", + "host" : None, "blocked": True, - "limit": step + "limit" : step })) else: # NOISY-DEBUG: print("DEBUG: Sending JSON API request to domain,step,counter:", domain, step, counter) doc = post_json_api(domain,"/api/federation/instances", json.dumps({ - "sort": "+caughtAt", - "host": None, + "sort" : "+caughtAt", + "host" : None, "blocked": True, - "limit": step, - "offset": counter-1 + "limit" : step, + "offset" : counter-1 })) # NOISY-DEBUG: print("DEBUG: doc():", len(doc)) @@ -501,7 +503,7 @@ def get_misskey_blocks(domain: str) -> dict: # NOISY-DEBUG: print("DEBUG: Returning for domain,blocked(),suspended():", domain, len(blocks["blocked"]), len(blocks["suspended"])) return { - "reject": blocks["blocked"], + "reject" : blocks["blocked"], "followers_only": blocks["suspended"] }