aboutsummaryrefslogtreecommitdiff
path: root/cli/main.py
blob: 5ac94db93e558f3c2f52c88eacc4697c56aa63d1 (plain)
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
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)