]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 12 Jun 2023 03:07:54 +0000 (05:07 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 12 Jun 2023 03:08:57 +0000 (05:08 +0200)
- added optional --domain parameter to fetch only from one oliphant blocklist
  files

fba/boot.py
fba/commands.py

index 525ef6b31c514ccbc758e1bd292b3e18e1bb3e9a..509333d5b04bfbc974b8cb498ba86646ce7c4102 100644 (file)
@@ -88,6 +88,7 @@ def init_parser():
         "fetch_oliphant",
         help="Fetches CSV files (block recommendations) for more possible instances to disover",
     )
+    parser.add_argument("--domain", help="Instance name (aka. domain) to check")
     parser.set_defaults(command=commands.fetch_oliphant)
 
     ### Fetch instances from given initial instance ###
index 8d5401d7535b40e59e283253e187411774b8d94f..165b67cf00f9eacea59f3c8c34516682877abb61 100644 (file)
@@ -537,8 +537,13 @@ def fetch_oliphant(args: argparse.Namespace):
     )
 
     for block in blocklists:
+        # Is domain given and not equal blocker?
+        if isinstance(args.domain, str) and args.domain != block["blocker"]:
+            # DEBUG: print(f"DEBUG: Skipping blocker='{block['blocker']}', not matching args.domain='{args.domain}'")
+            continue
+
         # Fetch this URL
-        print(f"DEBUG: Fetching csv_url='{block['csv_url']}' for blocker='{block['blocker']}' ...")
+        print(f"INFO: Fetching csv_url='{block['csv_url']}' for blocker='{block['blocker']}' ...")
         response = fba.fetch_url(f"{base_url}/{block['csv_url']}", network.web_headers, (config.get("connection_timeout"), config.get("read_timeout")))
 
         # DEBUG: print(f"DEBUG: response[]='{type(response)}'")