No project description provided
Project description
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:
Create a testing virtualenv
Install the test requirements
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
$
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
Built Distribution
File details
Details for the file togglwrapper-1.2.0.tar.gz
.
File metadata
- Download URL: togglwrapper-1.2.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edd275ea3a816328796a48cb7b91c7de2cb17aa564ea0b4af3916b8a5ba85d69 |
|
MD5 | e3a636a7cc7a1d5cb7686ce2f8d10644 |
|
BLAKE2b-256 | bb6ab0758c7184e390ccbf4eae009c2345df5af4d2ad3fa5b9f53f0fee23e6b3 |
File details
Details for the file togglwrapper-1.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: togglwrapper-1.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 9.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.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41c367bb201d75564a1ee92ebf895141294f5111e6b9d93d2932d3346b8affc2 |
|
MD5 | c380fd4d30a5053a75f8e2f36f76497c |
|
BLAKE2b-256 | e795a6076e04df9abd616023503c1c1004989c11c9623985d9f58b23c66f5d62 |