Official Python SDK for Budgero - Privacy-First Zero Based Budget Manager
Project description
Budgero Python SDK
Official Python SDK for Budgero - Privacy-First Zero Based Budget Manager.
Installation
pip install budgero
Quick Start
from budgero import BudgeroClient
# Initialize the client with your API key and encryption key
client = BudgeroClient(
api_key="your-api-key",
encryption_key="your-encryption-key",
)
# Add a transaction
result = client.add_transaction(
account_id=1,
category_id=5,
budget_id=1,
date="2024-11-27",
outflow=50.00,
memo="Weekly groceries",
payee="Whole Foods",
)
print(f"Transaction queued: {result.queue_id}")
Getting Your Credentials
- Open the Budgero app
- Go to Settings > Integrations > Push API
- Generate a new API key
- Copy both the API key and encryption key
Features
- End-to-end encryption: All transaction data is encrypted client-side before being sent to the server
- Type-safe: Full type hints for IDE autocompletion and type checking
- Simple API: Easy-to-use methods for common operations
- Self-hosted support: Works with self-hosted Budgero instances
Usage Examples
Record an Expense
client.add_transaction(
account_id=1,
category_id=5, # Groceries
budget_id=1,
date="2024-11-27",
outflow=50.00,
memo="Weekly groceries",
payee="Whole Foods",
)
Record Income
from datetime import date
client.add_transaction(
account_id=1,
category_id=10, # Income category
budget_id=1,
date=date.today(),
inflow=3000.00,
memo="Monthly salary",
payee="Acme Corp",
)
Using Context Manager
from budgero import BudgeroClient
with BudgeroClient(api_key="...", encryption_key="...") as client:
client.add_transaction(
account_id=1,
category_id=5,
budget_id=1,
date="2024-11-27",
outflow=25.00,
memo="Coffee",
)
# Client is automatically closed
Check Queue Status
# Get pending items
queue = client.get_queue()
for item in queue:
print(f"{item.id}: {item.status}")
# Get statistics
stats = client.get_queue_stats()
print(f"Pending: {stats['pending']}")
Self-Hosted Instance
client = BudgeroClient(
api_key="your-api-key",
encryption_key="your-encryption-key",
base_url="https://budgero.mycompany.com",
)
API Reference
BudgeroClient
__init__(api_key, encryption_key, *, base_url, timeout)
Initialize the client.
api_key: Your Budgero Push API keyencryption_key: Your encryption key (hex or base64 format)base_url: API base URL (default:https://my.budgero.app)timeout: Request timeout in seconds (default: 30)
add_transaction(...)
Add a new transaction to your budget.
account_id: ID of the accountcategory_id: ID of the category (None for transfers)budget_id: ID of the budgetdate: Transaction date (string or date object)inflow: Amount flowing in (default: 0)outflow: Amount flowing out (default: 0)memo: Description (default: "")payee: Payee name (optional)transfer_id: Transfer ID for linked transfers (optional)
get_queue()
Get pending items in the push queue.
get_queue_stats()
Get statistics about the push queue.
clear_queue()
Clear all items from the push queue.
health_check()
Check if the API is healthy.
close()
Close the client and release resources.
Data Models
TransactionInput
from budgero import TransactionInput
tx = TransactionInput(
account_id=1,
category_id=5,
budget_id=1,
date="2024-11-27",
inflow=0.0,
outflow=50.00,
memo="Groceries",
payee="Store",
)
Error Handling
from budgero import BudgeroClient, AuthenticationError, APIError, ValidationError
try:
client.add_transaction(...)
except AuthenticationError:
print("Invalid API key")
except ValidationError as e:
print(f"Invalid input: {e}")
except APIError as e:
print(f"API error: {e} (HTTP {e.status_code})")
Requirements
- Python 3.9+
- httpx
- pycryptodome
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file budgero-0.1.3.tar.gz.
File metadata
- Download URL: budgero-0.1.3.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
661a00567d33a3494a03f0873e26a5fd93b61da69192a9744298a14fe34f8c65
|
|
| MD5 |
f233bf5d15c0bc72c7deeedac86eda13
|
|
| BLAKE2b-256 |
564a68feb2ffa9dd75b38a50c08fff899699f9ff42fc87fe6207fc3dfac299a7
|
File details
Details for the file budgero-0.1.3-py3-none-any.whl.
File metadata
- Download URL: budgero-0.1.3-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f01bf670c905b3362f1ab62b7c4426818cff9fec2e47c4b5f4c0838c0db3b917
|
|
| MD5 |
11beb8769e1ed4889f52ee909233a9f8
|
|
| BLAKE2b-256 |
eb6dfe135b99eac30458c85b7a2b9f4111d492f35b180bc9d538da7337ff0fb5
|