GitXplorerGitXplorer
a

lunchmoney-python

public
2 stars
1 forks
1 issues

Commits

List of commits on branch main.
Verified
65acb69f95db86ed2056083dab7a79c12bafeb64

Merge pull request #2 from alanbato/pre-commit-ci-update-config

aalanbato committed 3 years ago
Verified
71001717f8c3d1fa054f1c820d0a5d15a431916b

Merge pull request #1 from alanbato/testing

aalanbato committed 3 years ago
Verified
b2e8396effefd7e92cbc9340dc9901a69d3476e6

[pre-commit.ci] pre-commit autoupdate

ppre-commit-ci[bot] committed 3 years ago
Unverified
7407269a887facc764f56619bb57ab4059377ea4

Remove always-record from update tests

aalanbato committed 4 years ago
Unverified
fc4f2c05030a17e9221284522d2381059115e44e

Add testing environment and API secret

aalanbato committed 4 years ago
Unverified
369003a78d504bd9d474a93609e512b8fe111692

Remove support for <3.8

aalanbato committed 4 years ago

README

The README file for this repository.

lunchmoney

pre-commit.ci status

This library is a Python client for the Lunch Money API.

This software is considered to be in Alpha state, as all endpoints of the API have not yet been implemented.

Installation

You can install this library by running

$ pip install lunchmoney

Usage

In order to use the client, you need to set the LUNCHMONEY_API_KEY enviroment variable with your API Token, which you can get by going to Settings > Developers > Request new Access Token.

Examples

Create a client

from lunchmoney import LunchMoneyClient

client = LunchMoneyClient()

Get the list of categories

categories = client.categories()
print(categories)
# [Category(id=214038, name='Alcohol, Bars', description=None, is_income=False, exclude_from_budget=False, exclude_from_totals=False, updated_at=datetime.datetime(2021, 6, 7, 22, 14, 6, 379000, tzinfo=datetime.timezone.utc), created_at=datetime.datetime(2021, 6, 7, 22, 14, 6, 379000, tzinfo=datetime.timezone.utc), is_group=False, group_id=None), Category(...), ...]

Insert a Transaction

trx_data = {
  "date": "2021-06-06",
  "payee": "Sushi House",
  "amount": 50.99,
  "currency": "usd",
}
trx_ids = client.insert_transaction(trx_data)
print(trx_ids)
# [3322341]

You can also instert multiple transactions by passing a list of transactions to client.insert_transactions()

Query Transactions

trxs = client.transactions(category_id=323401)
print(trxs)
# [Transaction(id=41078765, date='2021-06-06', amount=70.0, payee='Sushi House', currency='usd', status=<TransactionStatus.uncleared: 'uncleared'>, category_id=214038, asset_id=None, parent_id=None, plaid_account_id=None, is_group=False, group_id=None, external_id=None, tags=None, notes=None), ...]

Contributing

This library is still in development, and pull requests are welcome. For ideas on what to contribute, take a look at Lunch Money's API Reference, and try to implement a missing endpoint or parameter.

Developing

  1. Fork this repository, clone your fork, and add this repository remote as upstream.
  2. Run make setup in the project directory.
  3. Make your changes, write your tests.
  4. Try out your changes in the repl with make repl.
  5. Run make test for tests, and make lint for linting.
  6. Once you're happy with your changes, submit a PR!