diff --git a/src/__main__.py b/src/__main__.py index 6f178db..ac4dc71 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -72,7 +72,7 @@ def main(): "--blocklists", "-b", help="Either a blocklist hosts file or a directory containing blocklist hosts files", # noqa E501 - default="blocklists", # Not really needed because the get_blocklists function will default to this # noqa: E501 + default="blocklists", # Not really needed because the get_blocklists function will default to this # noqa: E501 ) upload_parser.add_argument( "--whitelists", diff --git a/src/utils/delete.py b/src/utils/delete.py index e1d2ec3..878e3c2 100644 --- a/src/utils/delete.py +++ b/src/utils/delete.py @@ -46,7 +46,7 @@ def delete_adblock_policy(policies: dict, account_id: str, token: str): def main(): account_id = input("Enter your Cloudflare account ID: ") token = input("Enter your Cloudflare API token: ") - + rules = utils.get_gateway_rules(account_id, token) delete_adblock_policy(rules, account_id, token) lists = utils.get_lists(account_id, token) diff --git a/src/utils/upload.py b/src/utils/upload.py index b5513a6..b394152 100644 --- a/src/utils/upload.py +++ b/src/utils/upload.py @@ -5,7 +5,7 @@ import requests from . import utils -def get_blocklists(hosts_path: str = 'blocklists'): +def get_blocklists(hosts_path: str = "blocklists"): blocklists = [] hosts_path = pathlib.Path(hosts_path) if hosts_path.is_file(): @@ -18,7 +18,7 @@ def get_blocklists(hosts_path: str = 'blocklists'): return blocklists -def apply_whitelists(blocklists, whitelist: str = 'whitelists'): +def apply_whitelists(blocklists, whitelist: str = "whitelists"): # If whitelist is a file, convert it to a list. # If whitelist is a directory, convert all files in it to a list and combine them. # If it does not exist, return the original blocklists @@ -102,7 +102,6 @@ def create_dns_policy(lists, account_id: str, token: str) -> None: def main(): - account_id = input("Enter your Cloudflare account ID: ") token = input("Enter your Cloudflare API token: ") @@ -114,5 +113,6 @@ def main(): cloud_lists = utils.filter_adblock_lists(cloud_lists) create_dns_policy(cloud_lists, account_id, token) + if __name__ == "__main__": main()