Official Python SDK for the Klink Finance platform - Publisher and Advertiser APIs
Project description
Klink Finance Python SDK
Official Python SDK for the Klink platform. This SDK provides a simple and consistent interface for both Publishers and Advertisers to integrate with Klink's API.
Features
- 🚀 Easy to use - Simple initialization and intuitive API
- 🔐 Built-in authentication - Automatic request signing and auth headers
- 📝 Full type hints - Complete type annotations for better IDE support
- 🐛 Debug mode - Detailed logging for troubleshooting
- ⚡ Lightweight - Minimal dependencies (only requests library)
- 🐍 Python 3.8+ - Modern Python with dataclasses and type hints
Installation
pip install klinkfinance-sdk
Requirements
- Python >= 3.8
- requests >= 2.28.0
Quick Start
Basic Usage (Publisher)
from klinkfinance_sdk import KlinkSDK
# Initialize SDK using factory method - performs health check before initialization
# SDK will only be created if health check returns status 200
client = KlinkSDK.create({
"api_key": "your-api-key",
"api_secret": "your-api-secret", # Required for Publisher
})
# Use the publisher client
publisher = client.publisher()
# Fetch offers
response = publisher.get_offers({
"page": 1,
"limit": 50,
"category": ["gaming", "finance"],
"country": "US",
"device_name": "android",
})
print(f"Fetched {len(response['data'])} offers")
Basic Usage (Advertiser)
from klinkfinance_sdk import KlinkSDK
# Initialize SDK - api_secret is optional for Advertiser
client = KlinkSDK.create({
"api_key": "your-api-key",
# "api_secret": "your-api-secret", # Optional for Advertiser
})
# Use the advertiser client
advertiser = client.advertiser()
# Send postback
advertiser.send_postback({
"event_name": "create_account",
"offer_id": "offer_123",
"sub1": "sub1_value",
"tx_id": "tx_123",
"isChargeback": False,
"chargebackReason": "",
"isTest": True,
})
Error Handling
from klinkfinance_sdk import (
KlinkSDK,
KlinkConfigException,
KlinkAuthException,
KlinkAPIException,
KlinkNetworkException,
)
try:
client = KlinkSDK.create({
"api_key": "invalid-key",
"api_secret": "invalid-secret",
})
except KlinkConfigException as e:
print(f"Configuration error: {e}")
except KlinkAuthException as e:
print(f"Authentication failed: {e}")
except KlinkAPIException as e:
print(f"API error: {e} (Status: {e.status_code})")
except KlinkNetworkException as e:
print(f"Network error: {e}")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
klinkfinance_sdk-1.0.1.tar.gz
(23.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file klinkfinance_sdk-1.0.1.tar.gz.
File metadata
- Download URL: klinkfinance_sdk-1.0.1.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daef73db5bf4b31e058a51332249289decbb4cc80948d55bf1482da2d161f35c
|
|
| MD5 |
2f55bac52997ced493a7933f771d506c
|
|
| BLAKE2b-256 |
9866a28093bbce77f962f9ec0c401e0756ad47a9a8799a7d4fdb8b81bac782c3
|
File details
Details for the file klinkfinance_sdk-1.0.1-py3-none-any.whl.
File metadata
- Download URL: klinkfinance_sdk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 30.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87baca9945c67bb046c8f87aba1664068bf8a0b9c57382d0727153afe97aa6ee
|
|
| MD5 |
801ee561de0548abb1da9e60f3fe5ca8
|
|
| BLAKE2b-256 |
4b9bd4113f9977dbb38a1e9622c9ae2821dfa61895298c6fc6f5ae040fb3fe69
|