aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Powers <mark@marks.kitchen>2022-02-27 15:42:55 -0600
committerMark Powers <mark@marks.kitchen>2022-02-27 15:42:55 -0600
commit7af895febdebb1a5160213372eb482f95ba2bb96 (patch)
treec186ee80a13c550a501691322c49e77f31757ef2
parentfdafefeabefb8f277bda209a1fd0374b14ce97e2 (diff)
Add python cli to create transactionsHEADmaster
-rw-r--r--cli/main.py28
1 files changed, 28 insertions, 0 deletions
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)