From 0fe16980ab997a2671416b0ac31c5326b368188c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 30 May 2023 03:19:40 +0200 Subject: [PATCH] Continued: - fixed indenting - also include type (exception name) in log message --- fetch_blocks.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fetch_blocks.py b/fetch_blocks.py index 972f47e..ebf3697 100755 --- a/fetch_blocks.py +++ b/fetch_blocks.py @@ -121,7 +121,7 @@ for blocker, software, origin, nodeinfo_url in rows: blockdict.append( { "blocked": blocked, - "reason": None + "reason" : None }) else: # NOISY-DEBUG: print("DEBUG: Updating last_seen:", blocker, blocked, block_level) @@ -174,15 +174,15 @@ for blocker, software, origin, nodeinfo_url in rows: fba.connection.commit() except Exception as e: - print(f"ERROR: blocker='{blocker}',software='{software}',exception='{str(e)}'") + print(f"ERROR: blocker='{blocker}',software='{software}',exception[{type(e)}]:'{str(e)}'") elif software == "mastodon": print("INFO: blocker:", blocker) try: # json endpoint for newer mastodongs try: json = { - "reject": [], - "media_removal": [], + "reject" : [], + "media_removal" : [], "followers_only": [], "report_removal": [] } @@ -208,7 +208,7 @@ for blocker, software, origin, nodeinfo_url in rows: for block in blocks: entry = { 'domain': block['domain'], - 'hash': block['digest'], + 'hash' : block['digest'], 'reason': block['comment'] } @@ -281,7 +281,7 @@ for blocker, software, origin, nodeinfo_url in rows: blockdict.append( { "blocked": blocked, - "reason": reason + "reason" : reason }) else: fba.update_last_seen(blocker, blocked if blocked.count("*") <= 1 else blocked_hash, block_level) @@ -292,7 +292,7 @@ for blocker, software, origin, nodeinfo_url in rows: fba.connection.commit() except Exception as e: - print(f"ERROR: blocker='{blocker}',software='{software}',exception='{str(e)}'") + print(f"ERROR: blocker='{blocker}',software='{software}',exception[{type(e)}]:'{str(e)}'") elif software == "friendica" or software == "misskey" or software == "bookwyrm" or software == "takahe": print("INFO: blocker:", blocker) try: @@ -361,7 +361,7 @@ for blocker, software, origin, nodeinfo_url in rows: blockdict.append( { "blocked": blocked, - "reason": reason + "reason" : reason }) else: fba.update_last_seen(blocker, blocked, block_level) @@ -372,7 +372,7 @@ for blocker, software, origin, nodeinfo_url in rows: fba.connection.commit() except Exception as e: - print(f"ERROR: blocker='{blocker}',software='{software}',exception='{str(e)}'") + print(f"ERROR: blocker='{blocker}',software='{software}',exception[{type(e)}]:'{str(e)}'") elif software == "gotosocial": print("INFO: blocker:", blocker) try: @@ -426,7 +426,7 @@ for blocker, software, origin, nodeinfo_url in rows: blockdict.append( { "blocked": blocked, - "reason": None + "reason" : None }) else: fba.update_last_seen(blocker, blocked, "reject") @@ -442,7 +442,7 @@ for blocker, software, origin, nodeinfo_url in rows: fba.connection.commit() except Exception as e: - print(f"ERROR: blocker='{blocker}',software='{software}',exception='{str(e)}'") + print(f"ERROR: blocker='{blocker}',software='{software}',exception[{type(e)}]:'{str(e)}'") else: print("WARNING: Unknown software:", blocker, software) -- 2.39.2