-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
38 lines (30 loc) · 958 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import argparse
import os
import sys
from src.main import run
import logging
from dotenv import find_dotenv, load_dotenv
if __name__ == '__main__':
# Parse filename.
parser = argparse.ArgumentParser(description="TODO write description.")
parser.add_argument('--file', help='Transactions filename')
args = parser.parse_args()
load_dotenv(find_dotenv())
username = os.environ['YNAB_USERNAME']
password = os.environ['YNAB_PASSWORD']
if not username:
print("No YNAB username provided")
sys.exit()
if not password:
print("No YNAB password provided")
sys.exit()
if not args.file:
print("Error: No filename provided")
sys.exit()
args.email = username
args.password = password
args.budgetname = "My Budget"
# Do not display pynYNAB logs in the console.
pynynab_logger = logging.getLogger('pynYNAB')
pynynab_logger.propagate = False
run(args)