Skip to main content

Python SDK for Daktela V6 REST API

Project description

Daktela V6 Python SDK

A Python SDK for the Daktela V6 REST API.

Installation

pip install daktela

Quick Start

from daktela import DaktelaClient, DaktelaConfig, DaktelaQuery, DaktelaFilter, DaktelaSort

# Initialize the client
client = DaktelaClient(
    DaktelaConfig(
        url="my.daktela.com",
        access_token="your-access-token"
    )
)

# Simple GET request
response = client.get("tickets")
print(f"Found {response.total} tickets")

# Query with filters, sorting, and pagination
query = (DaktelaQuery()
    .fields("name", "title", "stage")
    .filter(DaktelaFilter.eq("stage", "OPEN"))
    .sort(DaktelaSort.desc("created"))
    .take(50))

response = client.get("tickets", query)

for ticket in response:
    print(f"{ticket['name']}: {ticket['title']}")

# Iterate through large datasets efficiently
for ticket in client.iterate("tickets", query):
    print(ticket["name"])

# Close the client when done
client.close()

Features

  • Full CRUD operations (GET, POST, PUT, DELETE)
  • Fluent query builder with filters, sorting, and pagination
  • Memory-efficient pagination iterator
  • Automatic retry with exponential backoff
  • Rate limit handling with Retry-After support
  • Type hints for IDE support
  • Comprehensive exception hierarchy

Configuration

from daktela import DaktelaClient, DaktelaConfig, AuthMethod, RetryConfig, RateLimitConfig

config = DaktelaConfig(
    url="my.daktela.com",
    access_token="your-token",
    auth_method=AuthMethod.HEADER,  # or QUERY, COOKIE
    timeout=30.0,
    user_agent="MyApp/1.0",
    verify_ssl=True,
)

client = DaktelaClient(
    config,
    retry_config=RetryConfig(max_retries=5),
    rate_limit_config=RateLimitConfig(max_wait=120.0),
)

Query Building

Filters

from daktela import DaktelaFilter

# Comparison operators
DaktelaFilter.eq("field", "value")      # equals
DaktelaFilter.neq("field", "value")     # not equals
DaktelaFilter.gt("field", 5)            # greater than
DaktelaFilter.gte("field", 5)           # greater than or equal
DaktelaFilter.lt("field", 10)           # less than
DaktelaFilter.lte("field", 10)          # less than or equal
DaktelaFilter.like("field", "partial")  # contains

# List operators
DaktelaFilter.in_("status", ["A", "B", "C"])
DaktelaFilter.not_in("status", ["X", "Y"])

# OR combinations
DaktelaFilter.or_(
    DaktelaFilter.eq("stage", "OPEN"),
    DaktelaFilter.eq("stage", "PENDING")
)

Sorting

from daktela import DaktelaSort

DaktelaSort.asc("name")
DaktelaSort.desc("created")

Complete Query

from daktela import DaktelaQuery, DaktelaFilter, DaktelaSort

query = (DaktelaQuery()
    .fields("name", "title", "stage")
    .filter(DaktelaFilter.eq("stage", "OPEN"))
    .filter(DaktelaFilter.gte("priority", 5))
    .sort(DaktelaSort.desc("priority"))
    .sort(DaktelaSort.asc("created"))
    .take(100)
    .skip(0))

Error Handling

from daktela import (
    DaktelaException,
    DaktelaUnauthorizedException,
    DaktelaNotFoundException,
    DaktelaRateLimitException,
)

try:
    response = client.get("tickets/123")
except DaktelaNotFoundException:
    print("Ticket not found")
except DaktelaUnauthorizedException:
    print("Invalid access token")
except DaktelaRateLimitException as e:
    print(f"Rate limited, retry after {e.retry_after} seconds")
except DaktelaException as e:
    print(f"API error: {e.message}")

Pagination

# Automatic pagination through large datasets
for ticket in client.iterate("tickets", query, page_size=100):
    process(ticket)

# Limit total results
for ticket in client.iterate("tickets", query, max_items=500):
    process(ticket)

# Manual pagination
from daktela import DaktelaPagination

page = DaktelaPagination.page(page_number=2, page_size=25)
query = DaktelaQuery().pagination(pagination=page)

Health Check

# Simple ping
if client.ping():
    print("API is healthy")

# Detailed health check
health = client.health_check()
print(f"Healthy: {health['healthy']}")
print(f"Latency: {health['latency_ms']}ms")

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Type checking
mypy src/

# Linting
ruff check src/

License

MIT License - see LICENSE file for details.

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

daktela-1.0.0.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

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

daktela-1.0.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file daktela-1.0.0.tar.gz.

File metadata

  • Download URL: daktela-1.0.0.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for daktela-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b5d10d33ce1a6d9f0aa8e8e50df1acafe3ef5f1f264563959744a819d6a05c10
MD5 81b877c98a23da57484ab41fae38f0a3
BLAKE2b-256 dfd926830ba20e9dcb20b089d5708a25f6a63f8ec88f421167d57d80f2512b06

See more details on using hashes here.

Provenance

The following attestation bundles were made for daktela-1.0.0.tar.gz:

Publisher: publish.yml on Daktela/daktela-v6-python-connector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file daktela-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: daktela-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for daktela-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2f9a65aec789b98ec125fe4922c1b61950c05719d2092e9212b2292bfeb5526
MD5 625fbb8025e17541d0a2c059d8f29138
BLAKE2b-256 f6316669cbb9c9e1972d5bbeb41da126b55868d000cad3726c417fb4515f8942

See more details on using hashes here.

Provenance

The following attestation bundles were made for daktela-1.0.0-py3-none-any.whl:

Publisher: publish.yml on Daktela/daktela-v6-python-connector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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