Skip to main content

Python Wrapper for Toggl API

Project description

toggl-python-api-client
=======================

[Toggl](http://toggl.com) is an "insanely simple time tracking" service.

This specific library is a Python-based REST client to interface with the Toggle API utilizing [requests](http://docs.python-requests.org/en/latest/).

This library is a pure api client to help other python apps interface with Toggl. I created this project primarily to help with a bigger internal project that I am doing at work while at the same time getting my feet wet in Python.

# Others out there

There is already a similar library, [toggl_target](https://github.com/mos3abof/toggl_target) though it is more of an application and the client api is not separate repo. Some ideas/concepts on the client api were taken from there but I had needed a client api only to help interface with my bigger app.

# Usage

## Pypi Package
pip install python-toggl

## Manual installation
Download to a location of your choice and do the following.

```python

from toggl-python-api-client.api_client import TogglClientApi

settings = {
'token': 'xxx',
'user_agent': 'your app name'
}
toggle_client = TogglClientApi(settings)

response = toggle_client.get_workspaces()

```

# Dependencies

- Python 2.7 onwards
- [requests](http://docs.python-requests.org/en/latest/)

## Tests Dependencies

To run the tests, you will need the following packages

- unittest
- json
- [httpretty](https://github.com/gabrielfalcao/HTTPretty)

# Tests

Tests created under `/tests` are primarily integration tests and are not strictly unit tests. They consists of an offline and online(live) test.

## Offline

`tests/tests_offline.py`

These tests are for the logic of the api client. They do not connect to the actual Toggl servers - instead use [httpretty](https://github.com/gabrielfalcao/HTTPretty) to mock the responses. Sample responses are included in `tests/json_responses` and are based on Toggle responses for V8 of the main api and V2 of the report api.

## Online/Live

`tests/tests_live.py`

These tests are to check the connections to Toggl's API and to ensure that the client is handling the live responses from Toggl as expected.

To avoid adding sensitive data to version control, no api credentials have been included. To enable live tests,
- make a copy of `tests/tests_live_config.json.sample` as `tests/tests_live_config.json`
- update the settings on `tests/tests_live_config.json` as needed

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

python-toggl-0.1.3.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file python-toggl-0.1.3.tar.gz.

File metadata

  • Download URL: python-toggl-0.1.3.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python-toggl-0.1.3.tar.gz
Algorithm Hash digest
SHA256 bdacc11c25425758ad24ae251d32b5c44ed62da3c963021882a079adf39ac411
MD5 45d5332eb4627e34cbc99ce2e3a34dee
BLAKE2b-256 9b5b11df3de07679e23296c8cc87d1f695fdec26a92a5df60d0a5d512954be34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page