Allow `src/utils/__init__.py` to be empty
This commit is contained in:
parent
b971b8b0ae
commit
3eedaf77e2
|
@ -1,9 +1,7 @@
|
||||||
# To run from the root project directory, run the following command:
|
# To run from the root project directory, run the following command:
|
||||||
# python -m src.__main__
|
# python -m src.__main__
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
# Import the utils package
|
from .utils import upload, delete, utils
|
||||||
from . import utils
|
|
||||||
# import utils
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
@ -103,26 +101,26 @@ def main():
|
||||||
exit(1)
|
exit(1)
|
||||||
try :
|
try :
|
||||||
args.func(args)
|
args.func(args)
|
||||||
except AttributeError:
|
except AttributeError as e:
|
||||||
|
logger.debug(e)
|
||||||
argparser.print_help()
|
argparser.print_help()
|
||||||
pass
|
|
||||||
|
|
||||||
def upload_to_cloudflare(args):
|
def upload_to_cloudflare(args):
|
||||||
logger.info("Uploading to Cloudflare")
|
logger.info("Uploading to Cloudflare")
|
||||||
blocklists = utils.upload.get_blocklists(args.blocklists)
|
blocklists = upload.get_blocklists(args.blocklists)
|
||||||
blocklists = utils.upload.apply_whitelists(blocklists, args.whitelists)
|
blocklists = upload.apply_whitelists(blocklists, args.whitelists)
|
||||||
lists = utils.upload.split_list(blocklists)
|
lists = upload.split_list(blocklists)
|
||||||
utils.upload.upload_to_cloudflare(lists, ACCOUNT_ID, TOKEN)
|
upload.upload_to_cloudflare(lists, ACCOUNT_ID, TOKEN)
|
||||||
cloud_lists = utils.utils.get_lists(ACCOUNT_ID, TOKEN)
|
cloud_lists = utils.get_lists(ACCOUNT_ID, TOKEN)
|
||||||
cloud_lists = utils.utils.filter_adblock_lists(cloud_lists)
|
cloud_lists = utils.filter_adblock_lists(cloud_lists)
|
||||||
utils.upload.create_dns_policy(cloud_lists, ACCOUNT_ID, TOKEN)
|
upload.create_dns_policy(cloud_lists, ACCOUNT_ID, TOKEN)
|
||||||
def delete_from_cloudflare(args):
|
def delete_from_cloudflare(args):
|
||||||
logger.info("Deleting from Cloudflare")
|
logger.info("Deleting from Cloudflare")
|
||||||
rules = utils.utils.get_gateway_rules(ACCOUNT_ID, TOKEN)
|
rules = utils.get_gateway_rules(ACCOUNT_ID, TOKEN)
|
||||||
utils.delete.delete_adblock_policy(rules, ACCOUNT_ID, TOKEN)
|
delete.delete_adblock_policy(rules, ACCOUNT_ID, TOKEN)
|
||||||
lists = utils.utils.get_lists(ACCOUNT_ID, TOKEN)
|
lists = utils.get_lists(ACCOUNT_ID, TOKEN)
|
||||||
lists = utils.utils.filter_adblock_lists(lists)
|
lists = utils.filter_adblock_lists(lists)
|
||||||
utils.delete.delete_adblock_list(lists, ACCOUNT_ID, TOKEN)
|
delete.delete_adblock_list(lists, ACCOUNT_ID, TOKEN)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
from .utils import *
|
|
||||||
from .upload import *
|
|
||||||
from .delete import *
|
|
|
@ -98,6 +98,5 @@ def main():
|
||||||
cloud_lists = utils.filter_adblock_lists(cloud_lists)
|
cloud_lists = utils.filter_adblock_lists(cloud_lists)
|
||||||
create_dns_policy(cloud_lists)
|
create_dns_policy(cloud_lists)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue