Skip to main content

Ezeas Client API SDK (Python, async)

Project description

Ezeas Client SDK (Python)

Minimal async client for the ezeas Client API using HS256 JWT.

This SDK is intended for backend integrations (Python 3.9+).
It handles:

  • Generating and caching short-lived JWT access tokens
  • Sending authenticated requests to the ezeas Client API
  • Simple error handling for business errors (4xx) and internal errors (5xx)

Learn more:
https://www.ezeas.com/sdk/python


Installation

pip install ezeas-client

Requires Python 3.9+.


Quick start

import asyncio
from ezeas_client import EzeasClient

async def main() -> None:
    client = EzeasClient(
        client_id="your-client-id",
        client_secret="your-client-secret",
        tenant="workpac",
        environment="live",       # or: "sandbox"
    )

    async with client:
        # Create / upsert contact
        contact_result = await client.contact.create({
            "external_id": "EXT-123",
            "employee_number": "EMP-001",
            "first_name": "Jane",
            "last_name": "Doe",
            "mobile": "+61400000000",
            "email": "jane.doe@example.com",
            "tenure_date": "2025-11-01",
        })
        print("Contact:", contact_result)

        # Submit timesheet
        timesheet_result = await client.timesheet.create({
            "job_code": "JOB-001",
            "timesheet_entries": [
                {
                    "date": "2025-11-01",
                    "hours_ordinary": 8.0,
                    "hours_time_and_half": 2.0,
                    "hours_double_time": 0.0,
                },
                {
                    "date": "2025-11-02",
                    "hours_ordinary": 7.5,
                    "hours_time_and_half": 0.0,
                    "hours_double_time": 0.0,
                },
            ],
        })
        print("Timesheet:", timesheet_result)

if __name__ == "__main__":
    asyncio.run(main())

Types (logical shapes)

from typing import List, Optional, TypedDict

DateString = str  # ISO date string "YYYY-MM-DD"

class ContactInput(TypedDict, total=False):
    external_id: str
    employee_number: Optional[str]
    first_name: Optional[str]
    last_name: str
    mobile: Optional[str]
    email: str
    tenure_date: Optional[DateString]

class TimesheetEntry(TypedDict):
    date: DateString
    hours_ordinary: float
    hours_time_and_half: float
    hours_double_time: float

class TimesheetInput(TypedDict):
    job_code: str
    timesheet_entries: List[TimesheetEntry]

Error handling

  • 2xx → parsed JSON returned
  • 4xx → raises Exception with backend payload
  • 5xx → raises Exception("Internal server error <status>: <body>")

Wrap calls in your own try/except as needed.


Token format (HS256 JWT)

Payload includes:

  • sub: client_id
  • client_id: client_id
  • iat: issued-at
  • exp: expiry (+900 seconds)

Signed using client_secret.

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

ezeas_client-0.1.8.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ezeas_client-0.1.8-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file ezeas_client-0.1.8.tar.gz.

File metadata

  • Download URL: ezeas_client-0.1.8.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.7 Windows/11

File hashes

Hashes for ezeas_client-0.1.8.tar.gz
Algorithm Hash digest
SHA256 c673da3d9b793e3c468135aa0d760a3617090ae8ffa96e043c4e9ae8dcaacbf3
MD5 59580404db3739ca1bd999d7d156db2e
BLAKE2b-256 db69b37c206cd1b5c497cfe0b2c202be5e49ea051c98bbed221b04f2d20fe43a

See more details on using hashes here.

File details

Details for the file ezeas_client-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: ezeas_client-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.7 Windows/11

File hashes

Hashes for ezeas_client-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 841140ef166639234ca44bdde1dfe898165bb6234a41cc16f674fad1e81504d1
MD5 9abe6e83a5f8b4eb38403c7a1fec9df8
BLAKE2b-256 2465f6e6f6d4669e4db4c49add16f43ed692a580cefe546143fe23940605a129

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