A modern, async-first Python SDK for the Synchra API v2.0.
Project description
Synchra Python SDK (v2.0)
A modern, async-first Python SDK for the Synchra API, providing robust access to channel management, real-time events, and multi-platform moderation.
Features
- Async Native: Built from the ground up for
asynciousingaiohttp. - Full Type Safety: Comprehensive Pydantic v2 models for all API resources and WebSocket events.
- WebSocket Client: Real-time event subscription and dispatcher with automatic reconnection.
- Provider Support: Specialized API groups for Twitch, YouTube, and Kick.
- OAuth2 Ready: Support for both manual access tokens and full OAuth2 refresh flows.
Installation
pip install synchra
Quick Start
HTTP API Client
import asyncio
from synchra import SynchraClient
async def main():
# Initialize client (with token or OAuth credentials)
client = SynchraClient(access_token="YOUR_ACCESS_TOKEN")
# List channels
channels = await client.channels.list()
for channel in channels:
print(f"Channel: {channel.display_name} ({channel.id})")
# Get channel providers
providers = await client.channels.list_providers(channels[0].id)
for p in providers:
print(f"Provider: {p.provider} ({p.provider_channel_name})")
await client.close()
asyncio.run(main())
WebSocket Real-time Events
import asyncio
from synchra import SynchraClient
async def main():
client = SynchraClient(access_token="YOUR_ACCESS_TOKEN")
# Register an event handler
@client.ws.on("activity")
async def on_activity(event):
data = event['data']
print(f"[{event['type']}] New {data['type']} from {data['viewer_display_name']}")
# Connect and subscribe
await client.connect()
await client.ws.subscribe("activity", channel_id="YOUR_CHANNEL_UUID")
# Keep the client running
try:
while True:
await asyncio.sleep(1)
except KeyboardInterrupt:
await client.close()
asyncio.run(main())
Development & Testing
The SDK includes a full test suite using pytest.
# Install dev dependencies
pip install "synchra[dev]"
# Run tests
python -m pytest tests/
API Groups
client.channels: Main channel operations and provider listings.client.twitch: Twitch-specific features (Ban, Unban, Raid, Shoutout, Emulation).client.youtube: YouTube broadcasts and moderation.client.kick: Kick-specific moderation tools.
Documentation
For full API documentation and endpoint details, refer to the Synchra OpenAPI Spec.
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
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 synchra_py-0.1.1.tar.gz.
File metadata
- Download URL: synchra_py-0.1.1.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5365f50da6779fb49c01d6ebc421f7f5d0d64224704ab2fcfcddf391116fc64f
|
|
| MD5 |
bf06fa1fd4d0716e5df8a7a7d57d4b6a
|
|
| BLAKE2b-256 |
e2fa71f10b5cfe152cfc813e8da78752bb712985b055b3b2dc6c3612f34eb433
|
File details
Details for the file synchra_py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: synchra_py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 29.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b9ea1c3d538dd6efa0cd20630d5148a38f4d4cb81463aad029d57f5bc983662
|
|
| MD5 |
00a0bfd97ac333997ca444d5938711d4
|
|
| BLAKE2b-256 |
7239716da7d77edd2996a6f58ffd5c6fa72dafcf43705aa01db5cd8a484999f9
|