Skip to main content

Official Python SDK for the Alleo Customer API

Project description

Alleo Python SDK

Official Python SDK for the Alleo Customer API.

Install

pip install alleo
# or
uv add alleo

Requires Python 3.10+.

Quickstart — sync

from alleo import AlleoClient

with AlleoClient(access_key="...", secret_key="...") as client:
    companies = client.list_companies()
    for company in companies:
        print(company.id, company.name)

    # Iterate every employee across all pages lazily.
    for employee in client.list_employees_iter(company_id=companies[0].id, is_active=True):
        print(employee.id, employee.email)

Credentials can also come from the environment:

export ALLEO_ACCESS_KEY=...
export ALLEO_SECRET_KEY=...
# optional

Then:

with AlleoClient() as client:
    ...

Quickstart — async

import asyncio
from alleo import AsyncAlleoClient

async def main():
    async with AsyncAlleoClient() as client:
        companies = await client.list_companies()
        async for emp in client.list_employees_iter(companies[0].id):
            print(emp.id, emp.email)

asyncio.run(main())

Creating and updating employees

from alleo import AlleoClient, EmployeeCreate, EmployeeEdit

with AlleoClient() as client:
    new_emp = client.create_employee(
        company_id=42,
        body=EmployeeCreate(
            email="jane.doe@acme.com",
            first_name="Jane",
            last_name="Doe",
            language="en",
            company_group_id=1,
        ),
    )

    # PATCH — only the set fields are sent.
    client.update_employee(42, new_emp.id, EmployeeEdit(last_name="Doe-Smith"))

    client.deactivate_employee(42, new_emp.id)

Bodies also accept plain dicts.

Error handling

from alleo import AlleoClient, ConflictError, RateLimitError, ValidationError

with AlleoClient() as client:
    try:
        client.create_employee(42, {"email": "dup@acme.com", "first_name": "D", "last_name": "U"})
    except ConflictError as e:
        # 409 — duplicate email. e.message = server's "detail", e.response_body has the full body.
        ...
    except ValidationError as e:
        # 400 or 422. For 422 the message is a flattened "loc: msg" line per field.
        ...
    except RateLimitError as e:
        # Raised only after the SDK has exhausted its automatic retries.
        # e.retry_after has the server's last Retry-After in seconds.
        ...

All errors derive from AlleoError. See src/alleo/errors.py for the full taxonomy.

Rate limits

After every call, the last observed rate-limit headers are available on the client:

print(client.last_rate_limit)  # RateLimit(limit=600, remaining=599, reset_seconds=60)

The SDK retries 429 automatically (respecting Retry-After) up to max_retries=3 before raising RateLimitError.

Blueprint version

This SDK targets blueprint_version = "1". If the server publishes a v2 blueprint, upgrade to a matching SDK major version.

License

MIT — see LICENSE.

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

alleo-0.1.1.tar.gz (64.0 kB view details)

Uploaded Source

Built Distribution

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

alleo-0.1.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file alleo-0.1.1.tar.gz.

File metadata

  • Download URL: alleo-0.1.1.tar.gz
  • Upload date:
  • Size: 64.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for alleo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a3b2cfd576af8b95249113f34fd01acfca947b674c4c324d1cdef3de64a5f43f
MD5 d04a1a9636c36b95fa558c7f48aeec58
BLAKE2b-256 db22e5c8a865b444b27ad6b1c764b810576f9209410a57c550e3bce05116be62

See more details on using hashes here.

File details

Details for the file alleo-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: alleo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for alleo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 69fd616ac8bf6f16ed0e7c9ee8b32036828890ffc36357c765bc58334f4c0771
MD5 319ac182177602f3975ab09368c5be0c
BLAKE2b-256 07ff76d53062a858790b1bc6320bc54d3ff1c6cabfbe553f230db4f95c8625e4

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