Skip to main content

Python library to easily interface with Toggl’s API.

Implements all of Toggl’s main API. The Reports API is not yet supported (coming soon).

Works in Python 2.7+ and Python 3+, and uses requests.

Toggl

Toggl is free time tracking software.

Features

  • Handles authentication for you: only need to provide your API token once

  • The most complete Python wrapper: implements all of v8 API.

  • Convenient install from PyPI

  • Easy to make requests to custom URLs

  • Python2 and Python3 compatible

Install

$ pip install togglwrapper

Quickstart

>>> from togglwrapper import Toggl
>>> toggl = Toggl('your_api_token')
>>> toggl.User.get()
{u'data': {
    u'achievements_enabled': True,
    u'api_token': u'your_api_token',
    u'email': u'your_email@domain.com',
    u'fullname': u'Your Name',
    ...
    }
}
>>> toggl.Clients.get()
[{
    u'at': u'2015-07-02T14:27:59+00:00',
    u'id': 12031893,
    u'name': u'Client Name',
    u'wid': 3928
}]
>>> toggl.Workspaces.get()
[{
    u'admin': True,
    u'api_token': u'your_api_token',
    u'id': 1234,
    u'name': u"Your workspace",
    ...
}]
>>> toggl.Clients.create({"client":{"name":"Very Big Company", "wid": 1234}})
{u'data': {u'id': 294021, u'name': u'Very Big Company', u'wid': 1234}}

Custom Request

Let’s pretend that a new endpoint is released, for a new Toggl object: Addresses. This hypothetical endpoint is located at https://www.toggl.com/api/v8/addresses. We can GET all addresses, GET a specific address by ID, or POST to create a new address.

We can use the methods on the Toggl client, so we don’t have to wait for a new version of togglwrapper that supports the new endpoint:

>>> from togglwrapper import Toggl
>>> toggl = Toggl('your_api_token')
>>> toggl.get('/addresses')
...
>>> toggl.get('/addresses/{address_id}')
...
>>> toggl.post('/addresses', data={"address": {"name": "Billing Address 1", "address": "123 Main St."}})
...

toggl.put and toggl.delete are also available.

Documentation

Find the full documentation here: http://togglwrapper.readthedocs.org/en/latest/

API Endpoints Documentation

For full details on what fields are required, and what endpoints are available, see the Toggl API docs

Running tests locally

Using virtualenv + virtualenvwrapper to keep the environment isolated:

  1. Create a testing virtualenv

  2. Install the test requirements

  3. python tests.py

Sample command line output:

$ mkvirtualenv twtests  # if creating the virtualenv for the first time
Running virtualenv [...]
(twtest) $ pip install -r test_requirements.txt
Collecting [...]
(twtest) $ python tests.py
.......................................................
----------------------------------------------------------------------
Ran 55 tests in 0.414s

OK
(twtest) $ deactivate
$

Metadata

Release files for togglwrapper 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for togglwrapper 2.0.0
File Size Uploaded
togglwrapper-2.0.0.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for togglwrapper 2.0.0
File Interpreter ABI Platform
togglwrapper-2.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 23.5 kB

Release files / togglwrapper-2.0.0.tar.gz

Download URL togglwrapper-2.0.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e2b73c053f02fefbbb461d4c7fcc11a670aae2fb747d8b4f249e3b4a32b6ff5c
BLAKE2b-256 checksum
How to use checksums
136decee9ed32711c925a435928b66292c0c96818ef63d76eb6f6f5938a513ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.0

Release files / togglwrapper-2.0.0-py2.py3-none-any.whl

Download URL togglwrapper-2.0.0-py2.py3-none-any.whl
Size 9.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
88f204e211fcd0884658a0277acc0e32785522bc73434a73e877933c7fcd177d
BLAKE2b-256 checksum
How to use checksums
8d26a07247ed3c7e0c6215979b448dd678fe9718aef38bd95c89fec934ac6622
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.0

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page