added default path

This commit is contained in:
Kristian Krsnik 2023-08-02 20:34:16 +02:00
parent 28e7a2855e
commit 91e4b5f73a

View File

@ -1,10 +1,13 @@
import requests, json, re, os
from datetime import datetime
def loadSettings() -> dict:
def loadSettings(path = None) -> dict:
if path is None:
path = f"{os.path.expanduser('~')}/config.json"
# TODO: check integrity
try:
with open('config.json', 'r') as file:
with open(path, 'r') as file:
# Read if the API keys are path to files
config = json.load(file)
keys = config['api'].keys()