Python bindings for the Zaim API
Project description
zaim
Python bindings for the Zaim API. This also includes a command-line script (zaim).
How to install
$ pip install zaim
or
$ git clone https://github.com/hiromu2000/zaim
$ python setup.py install
How to use
For functions requiring no authentication
>>> import zaim
>>> api = zaim.Api()
>>> api.default_account()
For functions requiring authentication
>>> import zaim
>>> api = zaim.Api(consumer_key='consumer_key',
consumer_secret='consumer_secret',
access_token='access_token',
access_token_secret='access_token_secret')
>>> api.verify()
>>> response = api.payment(category_id='101',
genre_id='10101',
amount=1,
date='2020-04-01',
comment='comment',
name='name',
place='place',
from_account_id=0)
>>> api.money(mapping=1,
mode='payment',
start_date='2020-04-01',
end_date='2020-04-01')
>>> api.delete(mode='payment',
money_id=response['money']['id'])
For extended functions
>>> import zaim
>>> api = zaim.ExtendedApi(consumer_key='consumer_key',
consumer_secret='consumer_secret',
access_token='access_token',
access_token_secret='access_token_secret')
>>> response = api.payment(category_id='101',
genre_id='10101',
amount=1,
date='2020-04-01',
comment='comment',
name='name',
place='place',
from_account_id=0)
>>> api.search(mapping=1,
mode='payment',
place='place',
name='name',
comment='comment')
>>> api.delete(mode='payment',
money_id=response['money']['id'])
>>> api.search_category(u'食費')
>>> api.search_genre(u'カフェ')
>>> api.search_account(u'銀行')
How to use the command-line script
$ export ZAIM_CONSUMER_KEY="YOUR CONSUMER KEY"
$ export ZAIM_CONSUMER_SECRET="YOUR CONSUMER SECRET"
$ zaim token_get --callback-uri http://example.com
$ export ZAIM_CONSUMER_KEY=consumer_key
$ export ZAIM_CONSUMER_SECRET=consumer_secret
$ export ZAIM_ACCESS_TOKEN=access_token
$ export ZAIM_ACCESS_TOKEN_SECRET=access_token_secret
$ zaim money
$ zaim payment --category-id 101 --genre-id 10101 --amount 1 --place 'place'
--date '2020-04-01' --comment 'comment' --name 'name'
$ zaim delete --mode payment --money-id XXXXXXXXX
How to develop
Test
$ cd /path/to/zaim
$ export PYTHONPATH=$PYTHONPATH:/path/to/zaim/zaim
$ python tests/test_zaim_no_auth.py
$ export ZAIM_CONSUMER_KEY=consumer_key
$ export ZAIM_CONSUMER_SECRET=consumer_secret
$ export ZAIM_ACCESS_TOKEN=access_token
$ export ZAIM_ACCESS_TOKEN_SECRET=access_token_secret
$ python tests/test_api.py
$ python tests/test_extended_api.py
or simply
$ sudo pip install tox
$ cd /path/to/zaim
$ export ZAIM_CONSUMER_KEY=consumer_key
$ export ZAIM_CONSUMER_SECRET=consumer_secret
$ export ZAIM_ACCESS_TOKEN=access_token
$ export ZAIM_ACCESS_TOKEN_SECRET=access_token_secret
$ tox
Build
$ python setup.py sdist
$ python setup.py bdist_wheel --universal
ToDo
Documentation (written in Sphinx (reST) and hosted in readthedocs)
Enrich the command-line script
Argument validation for CLI (e.g., account-id)
Acknowledgements
A part of the codes is originally from here.
CHANGELOG
0.2.3 (2019-03-23)
Support 3.6 & 3.7 and drop 3.4.
0.2.2 (2015-11-15)
New Features
Added Create, Update, and Delete operations to the command-line script (zaim).
Added place to the list of arguments of income.
0.2.1 (2015-10-31)
New Features
Added all READ operations to the command-line script (zaim).
0.2.0 (2015-10-17)
New Features
Added command-line script (zaim). It currently only supports token-get, but will support many functions in the zaim API.
Bugfixes
Fixed a bug that was affecting Python 3.x: extended_api.py can now import api.py
0.1.0 (2015-10-11)
New Features
Added Extended API (search, search_category, search_genre, search_account
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
File details
Details for the file zaim-0.2.3.tar.gz
.
File metadata
- Download URL: zaim-0.2.3.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.4.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c92f23c1b68aa39ab31c4a91452c58616df39983bcef115f1a9cd4e7fb58a92 |
|
MD5 | 4659bfe2533d3284842e01acba18e0f9 |
|
BLAKE2b-256 | 1bd96ab498c02e0a133903acf0671cb1b45072997377bd699183304e7a29a8cf |
File details
Details for the file zaim-0.2.3-py2.py3-none-any.whl
.
File metadata
- Download URL: zaim-0.2.3-py2.py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.4.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8fe3122be19980322a40cf8a06267d46f681d1701327a1db6ae0eeb9df6f8fc |
|
MD5 | d8f079db44a537d2e0da889b34976bd5 |
|
BLAKE2b-256 | 0a8916d58375f6489fedf469a555310be318a4453c086d316c5504ba1f8b2fde |