Skip to main content

Python client library for Toshl API.

Project description

Travis-CI Status PyPI version

Python client library for Toshl API

Getting started with the library

To use the library, you first need to obtain a token from Toshl API.
Once you have a token you need to import the library and create an instance of the client:
from toshl.client import ToshlClient
client = ToshlClient('xxx-xxxxx-xxx-xxxxxx-xxxxxx-xxx-xxxxxx')

Every resource exposes the following methods:

  • list()

  • search()

  • get()

  • create()

  • update()

  • delete()

To use each resource you will need to create an instance of them, passing the client as parameter in the constructor.

Note: at the moment not all the methods and not all the resources have been implemented.

Here you can find a couple of examples, but for the complete documentation you can have a look at the official website https://developer.toshl.com/docs/

Accounts

from toshl.client import ToshlClient, Account

client = ToshlClient('xxx-xxxxx-xxx-xxxxxx-xxxxxx-xxx-xxxxxx')
account = Account(client)

# list all accounts
account.list()

# search for a specific account
account.search('Test Account')

Categories

from toshl.client import ToshlClient, Category

client = ToshlClient('xxx-xxxxx-xxx-xxxxxx-xxxxxx-xxx-xxxxxx')
category = Category(client)

# list all categories
category.list()

# search for a specific category
category.search('Test Category')

Entries

from toshl.client import ToshlClient, Entry

client = ToshlClient('xxx-xxxxx-xxx-xxxxxx-xxxxxx-xxx-xxxxxx')
entry = Entry(client)

# create an Entry
json_payload = {
    'amount': -123.68,
    'currency': {
        'code': 'GBP'
    },
    'date': '2016-04-07',
    'account': 'abcd1234',
    'category': 'category-001'
}

response = entry.create(json_payload)

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

toshl-0.0.3.tar.gz (3.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: toshl-0.0.3.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for toshl-0.0.3.tar.gz
Algorithm Hash digest
SHA256 fa2300ea38ff0f23298b37af28015911f4f1740c94355448cf8c0f79b3b516dc
MD5 41e02826573e32cc9a75e3345f5b6774
BLAKE2b-256 d6239ba7c101a88b9cf40a52cdc7469ee3b68639f716be280c7429467fe92eb9

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