Simple Toggl API wrapper for non-premium features.
Project description
Python Toggl API Wrapper
Simple Toggl API wrapper for non-premium features primarily focused on creating a cached framework for developing custom commands.
Installation
Install with pip:
pip install toggl-api-wrapper
Or if using SQLite cache:
pip install "toggl-api-wrapper[sqlite]"
Or if using async classes:
pip install "toggl-api-wrapper[async]"
Usage
- Currently supports interacting with Trackers, Projects, Clients, Tags, Reports and some extras.
- Designed to be rudimentary to allow simple development of custom commands.
Examples
Tracker Endpoint
from datetime import timedelta
from pathlib import Path
from toggl_api.config import generate_authentication
from toggl_api import TrackerBody, TrackerEndpoint, JSONCache
WORKSPACE_ID = 2313123123
AUTH = generate_authentication()
cache = JSONCache(Path("cache"), timedelta(hours=24))
endpoint = TrackerEndpoint(WORKSPACE_ID, AUTH, cache)
body = TrackerBody("My First Tracker", tags=["My First Tag"])
tracker = endpoint.add(body)
print(tracker)
Outputs:
>>> TogglTracker(
id=3482231563,
name="My First Tracker",
workspace=2313123123,
start=datetime.datetime(2024, 6, 10, 14, 59, 20, tzinfo=datetime.timezone.utc),
duration=datetime.timedelta(seconds=1, microseconds=179158),
stop=None,
project=None,
tags=[],
)
Project Endpoint
from datetime import timedelta
from pathlib import Path
from toggl_api import ProjectBody, ProjectEndpoint, TogglProject
from toggl_api.config import retrieve_togglrc_workspace_id, use_togglrc
from toggl_api.meta.cache import JSONCache
WORKSPACE_ID = retrieve_togglrc_workspace_id()
AUTH = use_togglrc()
cache = JSONCache[TogglProject](Path("cache"), timedelta(hours=24))
endpoint = ProjectEndpoint(WORKSPACE_ID, AUTH, cache)
color = ProjectEndpoint.get_color("red")
body = ProjectBody(
"My First Project",
client_name="My First Client",
color=color,
)
project = endpoint.add(body)
print(project)
Outputs:
>>> TogglProject(
id=203366783,
name='My First Project',
workspace=2313123123,
color='#d92b2b',
client=65298912,
active=True,
)
Documentation
Contributing
See CONTRIBUTING.
License
MIT. Check LICENSE for more information.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toggl_api_wrapper-2.0.0.tar.gz.
File metadata
- Download URL: toggl_api_wrapper-2.0.0.tar.gz
- Upload date:
- Size: 167.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0849d9d1396b33e7f4b7265a663088cfdd7198f9d774975d4c3788698b0ec80c
|
|
| MD5 |
2930fcba9de84a136cec7ac21d465dbf
|
|
| BLAKE2b-256 |
5ac88fa662f0d15b8bee6f23fd43a57b66685f11404ce3638244409fb19f8e53
|
File details
Details for the file toggl_api_wrapper-2.0.0-py3-none-any.whl.
File metadata
- Download URL: toggl_api_wrapper-2.0.0-py3-none-any.whl
- Upload date:
- Size: 88.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08b1daa60844d2aa281f59837f738b105e1599433596e92e325e965aa9900403
|
|
| MD5 |
452460edcdea1d419c758f3dfc6017d0
|
|
| BLAKE2b-256 |
cb0e0f7fc686c8f938adc3d89d58630d5dfa82f965819935af6108ed99f332c8
|