Getting Started
This guide walks you through installing the Kard Python SDK, authenticating with the Kard API, and making your first request.
Prerequisites
- Python 3.8+
KARD_CLIENT_IDandKARD_CLIENT_SECRET- Package manager:
pip
Install the SDK
Create a Client
Import and instantiate the KardApi client using your credentials.
This SDK supports two authentication methods:
OAuth Client Credentials
Bearer Token Authentication
The client automatically handles authentication, retries, and timeouts.
Make Your First API Calls
1. Creating a User:
3. Submitting Transaction for User:
All SDK methods return typed responses and raise typed errors.
Async Client
The SDK also provides an async client for non-blocking API calls.
Handling Errors
If an API request fails (4xx or 5xx), the SDK raises an ApiError.
Common Configuration Options
Configure Retries
Retries are enabled by default (max 2 attempts).
Set a Timeout
The SDK defaults to a 60 second timeout. Timeouts can be configured at the client or request level.
Access Raw HTTP Responses
To inspect headers or status codes, use with_raw_response.
Custom HTTP Client
You can supply a custom httpx.Client to customize transports, proxies, or networking behavior.