moneylover.me Python client library
A Python client library for interacting with the MoneyLover API.
pip install requestsfrom moneyloverc import MoneyLoverClient
# Login with credentials
client = MoneyLoverClient.login("your_email@example.com", "your_password")
# Export tokens for future use
refresh_token, client_id = client.export()# Restore from saved tokens
client = MoneyLoverClient.restore(refresh_token, client_id)
client.refresh() # Get new access tokenuser_info = client.get_user_info()
print(f"User: {user_info.email}")wallets = client.get_wallets()
for wallet in wallets:
print(f"Wallet: {wallet.name} (ID: {wallet.id})")wallet_id = wallets[0].id
categories = client.get_categories(wallet_id)
for category in categories:
print(f"Category: {category.name} ({category.type})")from datetime import datetime, timedelta
# Get transactions for the last 30 days
end_date = datetime.now()
start_date = end_date - timedelta(days=30)
transactions = client.get_transactions(wallet_id, start_date, end_date)
for transaction in transactions:
print(f"Transaction: {transaction.amount} - {transaction.note}")from moneyloverc import TransactionInput
# Create a new transaction
new_transaction = TransactionInput(
note="Coffee",
account=wallet_id,
category=category_id,
amount=4.50,
date=datetime.now()
)
# Add the transaction
result = client.add_transaction(new_transaction)The library provides several data classes for structured data:
UserInfo: User account informationWallet: Wallet/account informationCategory: Transaction category informationTransaction: Transaction detailsTransactionInput: Input for creating transactionsCampaign: Event/campaign informationCategoryType: Enum for income/expense categories
Enable debug mode to see HTTP requests and responses:
from moneyloverc import DEBUG_PAYLOAD
DEBUG_PAYLOAD = TrueSee example.py for a complete example of using the client library.
- Python 3.7+
- requests library
This project is based on the Go client library and converted to Python.