Official Python client for the DutyBeat public API.
Project description
dutybeat (Python)
Official Python client for the DutyBeat public API.
Install
pip install dutybeat
Usage
from dutybeat import DutyBeat
client = DutyBeat(api_key="db_live_...") # or set DUTYBEAT_API_KEY
user = client.users.get("9f1c...", include_folders=True)
print(user.full_name, user.email)
print(user.department.name)
print(user.profile.iban)
for folder in user.folders or []:
print(folder.name, folder.document_count)
# List users (paginated, filterable)
page = client.users.list(page_size=50, status="active", role="member")
for u in page: # UserPage is iterable
print(u.full_name, u.email)
print("total:", page.total)
# List an employee's workdays (marks, worked minutes, balance). `from_` because `from` is reserved.
days = client.attendance.list("9f1c...", from_="2026-06-01", to="2026-06-30")
for day in days: # AttendancePage is iterable
print(day.date, day.worked_minutes, day.balance_minutes)
# List absences overlapping a range (whole company, or one employee with user_id=...)
for absence in client.absences.list(from_="2026-06-01", to="2026-06-30", status="approved"):
print(absence.start_date, absence.end_date, absence.type.label)
Create an API key in the app under Configuración → Claves de API, and enable the methods each key
may call. Full reference: Configuración → API (or https://app.dutybeat.com/configuracion/api).
Errors
from dutybeat import DutyBeat, AuthenticationError, ForbiddenError, NotFoundError, RateLimitError
try:
client.users.get("9f1c...")
except NotFoundError:
... # 404
except ForbiddenError:
... # 403 — the key does not have this method enabled
except AuthenticationError:
... # 401 — bad / revoked / expired key
except RateLimitError as e:
print(e.retry_after) # 429
Every error exposes .status, .code and .message from the API's error envelope.
Configuration
| Argument | Default | |
|---|---|---|
api_key |
DUTYBEAT_API_KEY env |
Your db_live_... key |
base_url |
https://api.dutybeat.com |
Override for testing |
timeout |
30.0 |
Seconds |
max_retries |
2 |
Retries on 429/5xx, honouring Retry-After |
Development
pip install -e ".[dev]"
pytest
License
MIT
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
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 dutybeat-0.19.0.tar.gz.
File metadata
- Download URL: dutybeat-0.19.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86628ff81bb469d67c4578ebb413f181f323312895d921196ec1259a59f2f6eb
|
|
| MD5 |
8c9f0058c682014be50c8b72a7d141de
|
|
| BLAKE2b-256 |
ad4dac881e046142a02b35616b9d390aa8444a9b69499f243323d98f3692fa05
|
File details
Details for the file dutybeat-0.19.0-py3-none-any.whl.
File metadata
- Download URL: dutybeat-0.19.0-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0dfd5dbbedef300da8967072c2b75c174d0ab43b4eb4a324fdcfaca47869873
|
|
| MD5 |
72941adc1f8ad87e44f095a9a0af00a1
|
|
| BLAKE2b-256 |
5e30ff6c648c6fe88055d6702ce7c5622c09af5eb4255eb7263de72313d6b4e9
|