Official Python SDK for the Sesame HR API
Project description
Sesame HR Python SDK
Official Python SDK for the Sesame HR API. Synchronous client built on httpx with pydantic models. Python port of @sesamehr/sdk.
Install
pip install sesamehr
Requires Python 3.10+.
Quickstart
Authenticate with a private token — no OAuth required:
from sesamehr import SesameSDK
sdk = SesameSDK(
token="your-private-token",
region="EU1",
company_id="your-company-id",
employee_id="your-employee-id",
)
for employee in sdk.employees.working():
print(employee.name, employee.work_status)
Or login with email + password (same flow the SSO uses internally — no OAuth, no redirects):
sdk = SesameSDK.login("user@company.com", "****")
sdk.checks.clock_in()
The client holds an HTTP connection pool; use it as a context manager (or call sdk.close()) in long-running apps:
with SesameSDK.login("user@company.com", "****") as sdk:
stats = sdk.work_stats.summary("2026-06-01", "2026-06-30")
print(stats.seconds_worked, stats.balance)
Modules
| Module | Description |
|---|---|
sdk.employees |
List/search employees, work status, counts, me() profile with roles & permissions |
sdk.checks |
Clock in/out, breaks, check history, hours aggregation, check requests |
sdk.vacations |
Calendars, balances, day-off history, requests |
sdk.work_stats |
Hours worked vs expected, balance, averages |
sdk.evaluations |
Performance evaluations and results |
sdk.documents |
Browse directories, list/upload/download documents |
sdk.expenses |
Personal and company expenses, categories |
sdk.announcements |
Company announcements |
sdk.job_charges |
Job positions and assigned employees |
sdk.recruitment |
Vacancies, totals, candidates |
sdk.team |
Team status, manage checks, approve/reject requests (admin) |
sdk.reports |
Raw BI queries against any Sesame BI table |
sdk.contracts |
Contracts, expirations, type/status breakdowns |
sdk.notifications |
Push notifications to the mobile app |
sdk.community |
Wall channels, posts and comments; publish posts |
All methods return pydantic models with snake_case attributes (the camelCase API fields are mapped automatically; unknown fields are kept in model_extra).
Examples
# Check history for a date range (positional from/to)
entries = sdk.checks.history("2026-06-01", "2026-06-12", employee="ana")
# Vacation balance for the current year
balances = sdk.vacations.balance_by_employee()
# Raw BI query
from sesamehr import BI_TABLES, BI_TEMPORAL
rows = sdk.reports.query({
"from": BI_TABLES["checks"],
"select": [
{"field": "core_context_employee.name", "alias": "name"},
{"field": "schedule_context_check.seconds_worked", "aggregate": "SUM", "alias": "total"},
],
"where": [{"field": "schedule_context_check.date", "operation": BI_TEMPORAL["this_month"]}],
"group_by": ["core_context_employee.name"],
})
# Publish a post with an image to a community channel
with open("photo.png", "rb") as f:
sdk.community.create_post(
channel_id="...",
content="Hello from Python!",
file=f,
file_name="photo.png",
)
Error handling
from sesamehr import SesameApiError, SesameConnectionError
try:
sdk.checks.clock_in()
except SesameApiError as e:
print(e.status, e.message, e.errors)
except SesameConnectionError as e:
print("network problem:", e)
Requests are retried automatically (2 retries, 500 ms delay) on connection errors and 5xx responses; 4xx responses and timeouts are not retried.
Differences vs the TypeScript SDK
- Synchronous API (no
await). - Methods and fields are snake_case:
sdk.workStats.summary()→sdk.work_stats.summary(),employee.workStatus→employee.work_status. timeoutis in seconds (TS uses milliseconds). Default: 30.- Date-range methods take
from/toas positional arguments (fromis a reserved word in Python):sdk.checks.history("2026-06-01", "2026-06-12"). - OAuth helpers (
fromCredentials) are not included — authenticate with a private token,SesameSDK.login(), orSesameSDK.auto_login().
Development
python -m venv .venv && source .venv/bin/activate
pip install -e . pytest
pytest
License
MIT
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 sesamehr-0.1.0.tar.gz.
File metadata
- Download URL: sesamehr-0.1.0.tar.gz
- Upload date:
- Size: 37.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
831c1bcb7f8433a0fb219b3c36c26cb4e1e3467a38a03c0e26cd4909636719c8
|
|
| MD5 |
590cc359911de875d6e301bcb117c6bf
|
|
| BLAKE2b-256 |
fdecd4423666162c88ac8914aabdf20af193f88cf7910bc3d3f3b8b05cc5b8a7
|
Provenance
The following attestation bundles were made for sesamehr-0.1.0.tar.gz:
Publisher:
publish.yml on SesameHR/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sesamehr-0.1.0.tar.gz -
Subject digest:
831c1bcb7f8433a0fb219b3c36c26cb4e1e3467a38a03c0e26cd4909636719c8 - Sigstore transparency entry: 1822453277
- Sigstore integration time:
-
Permalink:
SesameHR/sdk-python@b46759cf8f89d4dd35d7864bb1f4d65c0dbab82f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/SesameHR
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b46759cf8f89d4dd35d7864bb1f4d65c0dbab82f -
Trigger Event:
release
-
Statement type:
File details
Details for the file sesamehr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sesamehr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06ae0a8abeac411a1ab80d105dd8b26354113157a8ee58bb57a86b7dafe1d994
|
|
| MD5 |
fed3c6964fe1fc2e2c00b7466f7d5b95
|
|
| BLAKE2b-256 |
b83a3d14a58ce260c6d8a836caabfdd6f8bdffaa449ed2496a0c088e8022dd35
|
Provenance
The following attestation bundles were made for sesamehr-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on SesameHR/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sesamehr-0.1.0-py3-none-any.whl -
Subject digest:
06ae0a8abeac411a1ab80d105dd8b26354113157a8ee58bb57a86b7dafe1d994 - Sigstore transparency entry: 1822453301
- Sigstore integration time:
-
Permalink:
SesameHR/sdk-python@b46759cf8f89d4dd35d7864bb1f4d65c0dbab82f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/SesameHR
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b46759cf8f89d4dd35d7864bb1f4d65c0dbab82f -
Trigger Event:
release
-
Statement type: