]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 30 May 2023 01:19:40 +0000 (03:19 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 30 May 2023 01:19:40 +0000 (03:19 +0200)
- fixed indenting
- also include type (exception name) in log message

fetch_blocks.py

index 972f47ec3ccc3c046d71275f11c209f3c4f4a73c..ebf3697eea7340935352befca654994bdbc540b0 100755 (executable)
@@ -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)