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.3.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

toshling-0.0.3-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: toshling-0.0.3.tar.gz
  • Upload date:
  • Size: 15.2 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.5

File hashes

Hashes for toshling-0.0.3.tar.gz
Algorithm Hash digest
SHA256 edb0eb7a383e5fc143f6f0cba092d958f5f05bb6fbde6fca2973eb99a0b6b3a7
MD5 748f51a16898396356f5e0c619ed0546
BLAKE2b-256 a93d48f4caba552a7d7e0e74695fff2635fb08fe04b64488f750a40e2fa30cfc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: toshling-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.3 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.5

File hashes

Hashes for toshling-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 70b34843060f77cad24fc944a32fe619ded393c0ddb6e64f203ab332d5cff3a1
MD5 e5bd4e65639a443412aab3739c705242
BLAKE2b-256 596e62529d5be02085da2fba9b4ce461793fca107643122f686de61cbbfad59c

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