Skip to main content

Python client library for Catapa API

Project description

CATAPA Python SDK

A comprehensive Python client library for the CATAPA API with ergonomic wrapper and automatic OAuth2 authentication handling.

Features

  • 🔐 Automatic OAuth2 Authentication - Client credentials flow with automatic token refresh
  • 🚀 Ergonomic API - Simple, intuitive interface for all CATAPA APIs
  • 📝 Full Type Support - Complete type hints with generated models
  • 📦 Direct Imports - from catapa import EmployeeApi
  • 🎯 Auto-Refresh Tokens - Tokens are automatically refreshed on every API call

Installation

# Install from local directory
pip install -e /path/to/catapa-python

When installed, two packages are available:

  • catapa: The main package with wrapper and authentication logic
  • openapi_client: The raw generated OpenAPI client code

Quick Start

from catapa import Catapa, EmployeeApi

# 1. Initialize the client
client = Catapa(
    tenant='your-tenant',
    client_id='your-client-id',
    client_secret='your-client-secret'
)

# 2. Create API instances and use them
employee_api = EmployeeApi(client)
employees = employee_api.list_all_employees(page=0, size=10)

print(f"Found {len(employees.content)} employees")

Usage Examples

Using Multiple APIs

You can import and use multiple API classes:

from catapa import Catapa, OrganizationApi, MasterDataApi, TaxApi

client = Catapa(
    tenant='your-tenant',
    client_id='your-client-id',
    client_secret='your-client-secret'
)

# Use different APIs with the same client
org_api = OrganizationApi(client)
company = org_api.get_companies()

master_data_api = MasterDataApi(client)
countries = master_data_api.get_countries()

tax_api = TaxApi(client)
tax_rates = tax_api.get_tax_rates()

Long-Running Services

The SDK is perfect for long-running services - tokens are automatically refreshed on every API call:

from catapa import Catapa, EmployeeApi
import time

client = Catapa(tenant='your-tenant', client_id='your-id', client_secret='your-secret')
employee_api = EmployeeApi(client)

# Make an API call
employees = employee_api.list_all_employees(page=0, size=10)

# Wait an hour (token would normally expire)
time.sleep(3600)

# This call will automatically refresh the token if needed
employees = employee_api.list_all_employees(page=0, size=10)  # ✅ Works!

Error Handling

from catapa import Catapa, EmployeeApi
from openapi_client.exceptions import ApiException

client = Catapa(tenant='your-tenant', client_id='your-id', client_secret='your-secret')
employee_api = EmployeeApi(client)

try:
    employees = employee_api.list_all_employees(page=0, size=10)
except ApiException as e:
    print(f"API Error: {e.status} - {e.reason}")

Available APIs

All CATAPA APIs are available through the catapa package:

from catapa import (
    Catapa,
    EmployeeApi,
    OrganizationApi,
    MasterDataApi,
    TaxApi,
    SalaryPaymentApi,
    PayrollProcessSnapshotApi,
    # ... and 40+ more APIs
)

Authentication

The client automatically handles OAuth2 authentication using client credentials flow. You don't need to manage tokens manually:

  • Automatic Token Refresh: Tokens are refreshed on every API call (5-minute buffer before expiration)
  • No Manual Management: No need to check token expiration or refresh manually

Requirements

  • Python 3.11+

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

catapa-0.1.2.tar.gz (397.6 kB view details)

Uploaded Source

Built Distribution

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

catapa-0.1.2-py3-none-any.whl (2.0 MB view details)

Uploaded Python 3

File details

Details for the file catapa-0.1.2.tar.gz.

File metadata

  • Download URL: catapa-0.1.2.tar.gz
  • Upload date:
  • Size: 397.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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 catapa-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fb558c6bd41565b5f0efcd340bd458dcfffc613ef9b03d8ad32c66fbcc798570
MD5 d60fe58e98323dbf3f011bcc918429a1
BLAKE2b-256 46680bc7e911e1179f347ead3f0107b4541a81b10c4c2cf7237b5a16ce00ee4a

See more details on using hashes here.

File details

Details for the file catapa-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: catapa-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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 catapa-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9fe6b67100c18f0f46c70ce8b66f1ed25d37046b0322a21a9305ccc6e8ea1633
MD5 f0d42dea4e7e4798d9d69af1da651d5b
BLAKE2b-256 f51f20dd5746cd9058b5f4c65ff7e5faab7dbcfdf6afabfb5479b411d9e2177c

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