Official Python SDK for Synora X402 Payment Gateway
Project description
Synora Python SDK
Official Python SDK for Synora X402 Payment Gateway.
Installation
pip install synora-sdk
Quick Start
import asyncio
from synora import SynoraClient
async def main():
client = SynoraClient(
wallet_private_key="your_private_key",
api_url="https://api.synora.io"
)
# Text analysis
result = await client.call('/tools/analyze', {
'text': 'What is the sentiment of this text?',
'model': 'gpt-4'
})
print(result)
# OCR
ocr_result = await client.call('/tools/ocr', {
'image_url': 'https://example.com/image.png'
})
print(ocr_result)
if __name__ == '__main__':
asyncio.run(main())
Features
- ✅ Async/await support
- ✅ Automatic retry with exponential backoff
- ✅ Type hints
- ✅ Comprehensive error handling
- ✅ Payment caching
API Reference
SynoraClient
class SynoraClient:
def __init__(
self,
wallet_private_key: str,
api_url: str = "https://api.synora.io",
max_retries: int = 3,
timeout: int = 30
)
Methods
call(endpoint: str, data: dict) -> dict
Make an API call with automatic payment handling.
result = await client.call('/tools/analyze', {
'text': 'Hello world',
'model': 'gpt-4'
})
get_balance() -> float
Get current USDC balance.
balance = await client.get_balance()
print(f"Balance: ${balance}")
Examples
See examples directory.
Requirements
- Python 3.7+
- aiohttp
- web3
- eth-account
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
synora_sdk-0.1.0.tar.gz
(4.3 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 synora_sdk-0.1.0.tar.gz.
File metadata
- Download URL: synora_sdk-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4f80e058023950bb6f762ae53391c12fb29984027e5cce3e4313ce3c275324b
|
|
| MD5 |
09dc35de9f92f46f6d1a619af541800d
|
|
| BLAKE2b-256 |
e805c11710cb2a0c8b6e549522b99862b6f36e62a244bad74aff1d17f8da72bd
|
File details
Details for the file synora_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: synora_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2cc4cba10edacf15d18bb91ada01dbe34d9d375cffba549ced17e07f79a998c
|
|
| MD5 |
ba7823dff667d76576bf48299b94c3ea
|
|
| BLAKE2b-256 |
371aed71b67efb049291119cb407a05cbccf64f4816b976680c9b0445bd3d024
|