From 7af895febdebb1a5160213372eb482f95ba2bb96 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Sun, 27 Feb 2022 15:42:55 -0600 Subject: Add python cli to create transactions --- cli/main.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cli/main.py diff --git a/cli/main.py b/cli/main.py new file mode 100644 index 0000000..5ac94db --- /dev/null +++ b/cli/main.py @@ -0,0 +1,28 @@ +import requests +import os + +if os.getenv("BUDGET_USERNAME", None): + username = os.getenv("BUDGET_USERNAME") +else: + username = input("Username: ") +if os.getenv("BUDGET_PASS", None): + password = os.getenv("BUDGET_PASS") +else: + password = input("Password: ") + +payload = { + "username": username, + "password": password, +} + +with requests.Session() as s: + p = s.post("https://budget.marks.kitchen/login", data=payload) + payload = { + "when": "", + "where": input("Where: "), + "amount": input("Amount: "), + "category": input("Category: "), + "subcategory": input("Subcategory: "), + } + p = s.post("https://budget.marks.kitchen/transaction", data=payload) + print(p.status_code) -- cgit v1.2.3