Skip to main content

PyToggl

The definitive Toggl library for Python.

Currently this library supports all API calls via the self.query and the self.query_report methods. They return the JSON that is documented in the Toggl API documentation.

In addition to the query methods, this library contains quite a few helpful methods and classes for working with Toggl data.

How To Use / Examples

Initialize the Library

from PyToggl import PyToggl
pytoggl = PyToggl('YOUR-API-KEY-HERE')

# Wasn't that easy?

Now do something with it.

# Grab our workspace(s)
workspaces = pytoggl.get_workspaces()

# Now grab all our users for the first workspace
users = pytoggl.get_workspace_users(workspaces[0].id)

Code:

# PyToggl creates objects out of all your query results that use the
# helper methods (ie. get_workspaces and get_workspace_users)

print(users[0].name)

Output:

John Smith

Code:

# The repr is very useful for debugging.
print(users[0])

Output:

class instance>.wid = 12345
class instance>.uid = 543210
class instance>.admin = False
class instance>.avatar_file_name = https://secure.gravatar.com/avatar/87vh8r7h8er7ch8wd7ch9wd7cj9wr7h?d=404&s=200
class instance>.id = 987656789
class instance>.inactive = False
class instance>.at = 2014-09-26T17:54:54+00:00
class instance>.active = True
class instance>.group_ids = [345678]
class instance>.email = johnsmith@notarealdomain.com
class instance>.name = John Smith

Code:

# All objects have a dict property.
print(users[0].dict)

Output:

{'active': True,
'admin': False,
'at': u'2014-09-26T17:54:54+00:00',
'avatar_file_name': u'https://secure.gravatar.com/avatar/87vh8r7h8er7ch8wd7ch9wd7cj9wr7h?d=404&s=200',
'email': u'johnsmith@notarealdomain.com',
'group_ids': [345678],
'id': 987656789,
'inactive': False,
'name': u'John Smith',
'uid': 543210,
'wid': 12345}

Code:

# All objects also have a json property
print(users[0].json)

Output:

'{"wid": 12345, "uid": 543210, "avatar_file_name": "https://secure.gravatar.com/avatar/87vh8r7h8er7ch8wd7ch9wd7cj9wr7h?d=404&s=200", "inactive": false, "at": "2014-09-26T17:54:54+00:00", "active": true, "id": 987656789, "group_ids": [345678], "name": "John Smith", "admin": false, "email": "johnsmith@notarealdomain.com"}'

CHANGES

Version 0.1.0 - 02 October 2014

  • Alpha version

Release files for PyToggl 0.2.6

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

Source distribution (sdist)

Source distribution for PyToggl 0.2.6
File Size Uploaded
PyToggl-0.2.6.tar.gz 6.1 kB Details

Release files / PyToggl-0.2.6.tar.gz

Download URL PyToggl-0.2.6.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
04018e565a9e04e339d98118d93974495be8a909f7899d87022f1c41f4254067
BLAKE2b-256 checksum
How to use checksums
e606fe743d00b5987c54ea2b20ad218d77afb2f664f0b1b95853b0c7736e3403
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.6 This release

1 release file

0.2.5

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

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