Skip to main content

a Python client library for the Toshl API

Project description

Toshling - a Python client library for the Toshl API

Toshling is an(other) implementation of a client for the Toshl API.

Installation

Toshling can be installed from the PyPI using pip:

pip install toshling

Usage

All interaction with Toshl is done via the Client class, which is constructed with your API key:

import toshling

client = toshling.Client('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')

Namespaces and methods under the client generally match the API documentation. All arguments passed must be in keyword=value form. Due to some keywords being reserved or invalid in Python, some substitutes must be made. Examples are below:

accounts = client.accounts.list()
groceries_category = client.categories.list(search='Groceries')[0]
everything_but_groceries = client.entries.list(account=accounts[0].id,
                                               from_='2020-12-01',
                                               to='2020-12-31', not_categories=groceries_category.id)
client.entries.create(amount=168.43,
                      currency={'code': 'AUD'},
                      date='2020-03-06',
                      desc='Toilet paper for COVID-19 end-of-days',
                      account=accounts[0].id,
                      category=groceries_category.id)

More details on the required argument types and their validation can be found in the toshling.models.argument_types and toshling.models.return_types.

Issues

Toshling has numerous flaws, mostly due to the incomplete JSON Hyper-Schema documents provided by Toshl, which are inconsistent, based on an old draft spec and do not match their actual API documentation.

Ideally the full client would be automatically generated from the schemas, but that is not currently possible. Instead, as much functionality as possible was implemented in a semi-automated manner, with the expectation that edge cases will present themself in day-to-day usage.

Please feel free to submit issues for consideration on GitHub.

Related libraries

  • toshl - a seemingly unmaintained API client missing some key features such as getting entries.
  • toshl-api - an autogenerated client without much documentation.

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

toshling-0.0.4.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

toshling-0.0.4-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file toshling-0.0.4.tar.gz.

File metadata

  • Download URL: toshling-0.0.4.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.6

File hashes

Hashes for toshling-0.0.4.tar.gz
Algorithm Hash digest
SHA256 1f42ba236a048416a6b2b79713357aae0b3f6196d74ba424a13a5e0363db5d17
MD5 b3fb665760a0b2949a4d013091c02281
BLAKE2b-256 3a57eb3a736e7b0826f3009669091e027a17f0467ab16bd455f57dcb9aa251ad

See more details on using hashes here.

File details

Details for the file toshling-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: toshling-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.6

File hashes

Hashes for toshling-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 54f7f7da3e8d89054da192e54ba01531c415d131fee01a7e0354d0f9d65e8b1b
MD5 8077e2b2cf6d0be88ac27f781584bf9d
BLAKE2b-256 b164db8a801467b64b266cb807126b01762e7bfb840df4df3c8c0ab72f110aa5

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