Read data dir from config

This commit is contained in:
Edward Betts 2023-10-02 23:35:43 +01:00
parent 147d84c793
commit ee133e4a00
2 changed files with 3 additions and 2 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@ __pycache__/
*.py[cod]
__pycache__
.mypy_cache
config

View file

@ -52,16 +52,16 @@ now = datetime.now()
today = now.date()
now_str = now.strftime("%Y-%m-%d_%H:%M")
now_utc = datetime.now(timezone.utc)
data_dir = "/home/edward/lib/data"
do_refresh = len(sys.argv) > 1 and sys.argv[1] == "--refresh"
next_us_presidential_election = date(2024, 11, 5)
next_uk_general_election = date(2024, 5, 2)
config = configparser.ConfigParser()
config.read(os.path.join(os.path.dirname(__file__), "config"))
config.read(os.path.join(os.path.dirname(__file__), "..", "config"))
access_key = config.get("exchangerate", "access_key")
data_dir = config.get("data", "dir")
def get_next_timezone_transition(tz_name: str) -> datetime: