Bug fix no more request limit (#18)
* added tests * Removed method no longer used due to YNAB api Changes
This commit is contained in:
@@ -24,6 +24,18 @@ def set_up_logging():
|
||||
queue_handler.listener.start()
|
||||
atexit.register(queue_handler.listener.stop)
|
||||
|
||||
def load_config():
|
||||
try:
|
||||
with open('config/config.yaml', 'r') as file:
|
||||
config = yaml.safe_load(file)
|
||||
return config
|
||||
except FileNotFoundError:
|
||||
logging.error('config.yaml file not found')
|
||||
sys.exit(ec.MISSING_CONFIG_FILE)
|
||||
except yaml.YAMLError as e:
|
||||
logging.error(f'Error loading config.yaml: {e}')
|
||||
sys.exit(ec.CORRUPTED_CONFIG_FILE)
|
||||
|
||||
logger = logging.getLogger("data_pipeline_for_ynab")
|
||||
os.makedirs('logs', exist_ok=True)
|
||||
set_up_logging()
|
||||
@@ -34,27 +46,14 @@ dotenv.load_dotenv()
|
||||
API_TOKEN = os.getenv('API_TOKEN')
|
||||
BUDGET_ID = os.getenv('BUDGET_ID')
|
||||
|
||||
|
||||
if not API_TOKEN or not BUDGET_ID:
|
||||
logging.error('API_TOKEN or BUDGET_ID is not set in .env file')
|
||||
sys.exit(ec.MISSING_ENV_VARS)
|
||||
|
||||
try:
|
||||
with open('config/config.yaml', 'r') as file:
|
||||
config = yaml.safe_load(file)
|
||||
except FileNotFoundError:
|
||||
logging.error('config.yaml file not found')
|
||||
sys.exit(ec.MISSING_CONFIG_FILE)
|
||||
except yaml.YAMLError as e:
|
||||
logging.error(f'Error loading config.yaml: {e}')
|
||||
sys.exit(ec.CORRUPTED_CONFIG_FILE)
|
||||
|
||||
config['API_TOKEN'] = API_TOKEN
|
||||
config['BUDGET_ID'] = BUDGET_ID
|
||||
|
||||
#sys.exit(ec.SUCCESS)
|
||||
|
||||
if __name__ == '__main__':
|
||||
config = load_config()
|
||||
config['API_TOKEN'] = API_TOKEN
|
||||
config['BUDGET_ID'] = BUDGET_ID
|
||||
try:
|
||||
pipeline_main(config)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user