# ynab-sdk-python
[![PyPI version](https://badge.fury.io/py/ynab-sdk.svg)](https://badge.fury.io/py/ynab-sdk)
[![Maintainability](https://api.codeclimate.com/v1/badges/b6042768d805939000c2/maintainability)](https://codeclimate.com/github/andreroggeri/ynab-sdk-python/maintainability)
[![codecov](https://codecov.io/gh/andreroggeri/ynab-sdk-python/branch/main/graph/badge.svg)](https://codecov.io/gh/andreroggeri/ynab-sdk-python)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
Python implementation of the YNAB API ([https://api.youneedabudget.com/](https://api.youneedabudget.com/))
## Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install `ynab-sdk-python`
```bash
pip install ynab-sdk
```
## Usage
Example of use with the default client:
```python
from ynab_sdk import YNAB
ynab = YNAB('some-key')
print(ynab.budgets.get_budgets())
```
Example of use with the cached client:
```python
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}/accounts | POST | Creates a new 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](https://choosealicense.com/licenses/apache-2.0/)
Raw data
{
"_id": null,
"home_page": "https://github.com/andreroggeri/ynab-sdk-python",
"name": "ynab-sdk",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "YNAB,YNAB API Endpoints,",
"author": "",
"author_email": "a.roggeri.c@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5c/90/f4997631c7fa7332bec1f6d8a34adc17befbace984ecab7bb6665d27c278/ynab-sdk-0.5.0.tar.gz",
"platform": null,
"description": "# ynab-sdk-python\n\n[![PyPI version](https://badge.fury.io/py/ynab-sdk.svg)](https://badge.fury.io/py/ynab-sdk)\n[![Maintainability](https://api.codeclimate.com/v1/badges/b6042768d805939000c2/maintainability)](https://codeclimate.com/github/andreroggeri/ynab-sdk-python/maintainability)\n[![codecov](https://codecov.io/gh/andreroggeri/ynab-sdk-python/branch/main/graph/badge.svg)](https://codecov.io/gh/andreroggeri/ynab-sdk-python)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nPython implementation of the YNAB API ([https://api.youneedabudget.com/](https://api.youneedabudget.com/))\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install `ynab-sdk-python`\n\n```bash\npip install ynab-sdk\n```\n\n## Usage\n\nExample of use with the default client:\n\n```python\nfrom ynab_sdk import YNAB\n\nynab = YNAB('some-key')\n\nprint(ynab.budgets.get_budgets())\n```\n\nExample of use with the cached client:\n\n```python\nfrom ynab_sdk import YNAB\nfrom ynab_sdk.utils.clients.cached_client import CachedClient\nfrom ynab_sdk.utils.configurations.cached import CachedConfig\n\nynab_config = CachedConfig(\n redis_host='redis-host',\n redis_port='redis-port',\n redis_db='redis-db',\n redis_pass='redis-password',\n api_key='some-key',\n)\nynab_client = CachedClient(ynab_config)\nynab = YNAB(client=ynab_client)\n\n# clear the cache\nynab_client.clear_cache()\n\n# set the cached data expiration time in seconds\n# if set to 0, negative or None, the cached data never expires\n# default value is 3600 seconds (1 hour)\nynab_config.redis_ttl = 120\n\nprint(ynab.budgets.get_budgets())\n```\n\n## Endpoints\n\nSee below whats implemented (Not fully updated yet)\n\n| Endpoint | Verb | Description | Working | Obs |\n| ---------------------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | --- |\n| /user | GET | Returns authenticated user information | NO | |\n| /budgets | GET | Returns budgets list with summary information | YES |\n| /budgets/{budget_id} | GET | Returns a single budget with all related entities. This resource is effectively a full budget export. | YES |\n| /budgets/{budget_id}/settings | GET | Returns settings for a budget | YES |\n| /budgets/{budget_id}/accounts | GET | Returns all accounts | YES |\n| /budgets/{budget_id}/accounts/{account_id} | GET | Returns a single account | YES |\n| /budgets/{budget_id}/accounts | POST | Creates a new account | YES |\n| /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). | |\n| /budgets/{budget_id}/categories/{category_id} | GET | Returns a single category. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). | |\n| /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). | |\n| /budgets/{budget_id}/months/{month}/categories/{category_id} | PATCH | Update a category for a specific month | |\n| /budgets/{budget_id}/payees | GET | Returns all payees | YES |\n| /budgets/{budget_id}/payees/{payee_id} | GET | Returns single payee | YES |\n| /budgets/{budget_id}/payee_locations | GET | Returns all payee locations | NO |\n| /budgets/{budget_id}/payee_locations/{payee_location_id} | GET | Returns a single payee location | NO |\n| /budgets/{budget_id}/payees/{payee_id}/payee_locations | GET | Returns all payee locations for the specified payee | NO |\n| /budgets/{budget_id}/months | GET | Returns all budget months | NO |\n| /budgets/{budget_id}/months/{month} | GET | Returns a single budget month | NO |\n| /budgets/{budget_id}/transactions | GET | Returns budget transactions | YES |\n| /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 |\n| /budgets/{budget_id}/transactions | PATCH | Updates multiple transactions, by 'id' or 'import_id'. | NO |\n| /budgets/{budget_id}/transactions/{transaction_id} | GET | Returns a single transaction | YES |\n| /budgets/{budget_id}/transactions/{transaction_id} | PUT | Updates a transaction | YES |\n| /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 |\n| /budgets/{budget_id}/accounts/{account_id}/transactions | GET | Returns all transactions for a specified account | YES |\n| /budgets/{budget_id}/categories/{category_id}/transactions | GET | Returns all transactions for a specified category | NO |\n| /budgets/{budget_id}/payees/{payee_id}/transactions | GET | Returns all transactions for a specified payee | NO |\n| /budgets/{budget_id}/scheduled_transactions | GET | Returns all scheduled transactions | NO |\n| /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} | GET | Returns a single scheduled transaction | NO |\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n\n[Apache License 2.0](https://choosealicense.com/licenses/apache-2.0/)\n",
"bugtrack_url": null,
"license": "",
"summary": "YNAB API Endpoints",
"version": "0.5.0",
"split_keywords": [
"ynab",
"ynab api endpoints",
""
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c1687f2d60a53c99dde371bbc87052d5ff7f4dc090befc3a078e79289a66e93b",
"md5": "ff93940a88afead12df9e5729254da9e",
"sha256": "9fd40e18f33878c7bd8f40f7f12a61c82465ad7a227194ea056b032ca7b3ae42"
},
"downloads": -1,
"filename": "ynab_sdk-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ff93940a88afead12df9e5729254da9e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 35041,
"upload_time": "2023-04-16T23:44:10",
"upload_time_iso_8601": "2023-04-16T23:44:10.780561Z",
"url": "https://files.pythonhosted.org/packages/c1/68/7f2d60a53c99dde371bbc87052d5ff7f4dc090befc3a078e79289a66e93b/ynab_sdk-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5c90f4997631c7fa7332bec1f6d8a34adc17befbace984ecab7bb6665d27c278",
"md5": "757961bf297996b88e068da733923cbc",
"sha256": "c78655956880f7a8367b5c5ad9b936b859d8d2202c892c6b862740c47ca1147b"
},
"downloads": -1,
"filename": "ynab-sdk-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "757961bf297996b88e068da733923cbc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20941,
"upload_time": "2023-04-16T23:44:12",
"upload_time_iso_8601": "2023-04-16T23:44:12.402524Z",
"url": "https://files.pythonhosted.org/packages/5c/90/f4997631c7fa7332bec1f6d8a34adc17befbace984ecab7bb6665d27c278/ynab-sdk-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-16 23:44:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "andreroggeri",
"github_project": "ynab-sdk-python",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "ynab-sdk"
}