Skip to content

Commit

Permalink
change to using pkgutils
Browse files Browse the repository at this point in the history
  • Loading branch information
stringertheory committed Jan 31, 2024
1 parent 7854560 commit b1bde45
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions clean_links/config.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import json
import pkgutil


def read_config(
additional_config_filename: str = "clean_links/clearurls_config.json"
additional_config_filename: str = "clearurls_config.json",
) -> dict:
with open("clean_links/clearurls.json") as infile:
clear_urls_rules = dict(json.load(infile))
data = pkgutil.get_data(__name__, "clearurls.json").decode("utf8")
clear_urls_rules = dict(json.loads(data))

with open(additional_config_filename) as infile:
additional_rules = json.load(infile)
data = pkgutil.get_data(__name__, additional_config_filename).decode("utf8")
additional_rules = dict(json.loads(data))

for provider_name, rules in additional_rules["providers"].items():
provider = clear_urls_rules["providers"].get(provider_name)
Expand Down

0 comments on commit b1bde45

Please sign in to comment.