Skip to main content

YNAB API Endpoints

Project description

ynab-sdk-python

PyPI version Maintainability codecov Code style: black

Python implementation of the YNAB API (https://api.youneedabudget.com/)

Warning

This is pretty much a work in progress, the basic stuff is working, but nothing is guaranteed. See below whats implemented and whats not

Installation

Use the package manager pip to install ynab-sdk-python

pip install ynab-sdk

Usage

Example of use with the default client:

from ynab_sdk import YNAB

ynab = YNAB('some-key')

print(ynab.budgets.get_budgets())

Example of use with the cached client:

from ynab_sdk import YNAB
from ynab_sdk.utils.clients.cached_client import CachedClient
from ynab_sdk.utils.configurations.cached import CachedConfig

ynab_config = CachedConfig(
    redis_host='redis-host',
    redis_port='redis-port',
    redis_db='redis-db',
    redis_pass='redis-password',
    api_key='some-key',
)
ynab_client = CachedClient(ynab_config)
ynab = YNAB(client=ynab_client)

# clear the cache
ynab_client.clear_cache()

# set the cached data expiration time in seconds
# if set to 0, negative or None, the cached data never expires
# default value is 3600 seconds (1 hour)
ynab_config.redis_ttl = 120

print(ynab.budgets.get_budgets())

Endpoints

See below whats implemented (Not fully updated yet)

Endpoint Verb Description Working Obs
/user GET Returns authenticated user information NO
/budgets GET Returns budgets list with summary information YES
/budgets/{budget_id} GET Returns a single budget with all related entities. This resource is effectively a full budget export. YES
/budgets/{budget_id}/settings GET Returns settings for a budget YES
/budgets/{budget_id}/accounts GET Returns all accounts YES
/budgets/{budget_id}/accounts/{account_id} GET Returns a single account YES
/budgets/{budget_id}/categories GET Returns all categories grouped by category group. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC).
/budgets/{budget_id}/categories/{category_id} GET Returns a single category. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC).
/budgets/{budget_id}/months/{month}/categories/{category_id} GET Returns a single category for a specific budget month. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC).
/budgets/{budget_id}/months/{month}/categories/{category_id} PATCH Update a category for a specific month
/budgets/{budget_id}/payees GET Returns all payees YES
/budgets/{budget_id}/payees/{payee_id} GET Returns single payee YES
/budgets/{budget_id}/payee_locations GET Returns all payee locations NO
/budgets/{budget_id}/payee_locations/{payee_location_id} GET Returns a single payee location NO
/budgets/{budget_id}/payees/{payee_id}/payee_locations GET Returns all payee locations for the specified payee NO
/budgets/{budget_id}/months GET Returns all budget months NO
/budgets/{budget_id}/months/{month} GET Returns a single budget month NO
/budgets/{budget_id}/transactions GET Returns budget transactions YES
/budgets/{budget_id}/transactions POST Creates a single transaction or multiple transactions. If you provide a body containing a 'transaction' object, a single transaction will be created and if you provide a body containing a 'transactions' array, multiple transactions will be created. YES
/budgets/{budget_id}/transactions PATCH Updates multiple transactions, by 'id' or 'import_id'. NO
/budgets/{budget_id}/transactions/{transaction_id} GET Returns a single transaction YES
/budgets/{budget_id}/transactions/{transaction_id} PUT Updates a transaction YES
/budgets/{budget_id}/transactions/bulk POST Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{budget_id}/transactions' to create multiple transactions. NO
/budgets/{budget_id}/accounts/{account_id}/transactions GET Returns all transactions for a specified account YES
/budgets/{budget_id}/categories/{category_id}/transactions GET Returns all transactions for a specified category NO
/budgets/{budget_id}/payees/{payee_id}/transactions GET Returns all transactions for a specified payee NO
/budgets/{budget_id}/scheduled_transactions GET Returns all scheduled transactions NO
/budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} GET Returns a single scheduled transaction NO

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ynab-sdk-0.3.0.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

ynab_sdk-0.3.0-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file ynab-sdk-0.3.0.tar.gz.

File metadata

  • Download URL: ynab-sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for ynab-sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e098fd52d8270f71bd09b3c1b7ef96d71bcfdc8f74e09e2a6f742418453b57bd
MD5 e006d33d7d8d38585ba4d3b8483d0709
BLAKE2b-256 8ff274057abfceb120577b5f3bb18d0faad742fbf0ba12f0fcb6f20c8a9143da

See more details on using hashes here.

File details

Details for the file ynab_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ynab_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for ynab_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0153c72ef8d79c9e9e91720823cbdceed35d71da257bd9a80d4852a77bdb8919
MD5 7bd2f1c46e19289ab3581b58c63c6735
BLAKE2b-256 1cbc9b78f399ede3daef72cb6408f57d4b5f7e174f76ec5f37bb12a68e3331b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page