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)