Mezon SDK Python
A Python implementation of the Mezon SDK for building bots and applications on the Mezon platform.
Features
- Async/Await Native - Built with
asynciofor high-performance concurrent operations - Real-time WebSocket - Full support for real-time messaging with automatic reconnection
- Type-Safe - Comprehensive type hints and Pydantic models
- Event-Driven - Elegant event handler system for reactive applications
- Protocol Buffers - Efficient binary serialization
- Production Ready - Proper error handling, logging, and graceful shutdown
Quick Install
Quick Example
import asyncio
from mezon import MezonClient
from mezon.models import ChannelMessageContent
from mezon.protobuf.api import api_pb2
client = MezonClient(
client_id="YOUR_BOT_ID",
api_key="YOUR_API_KEY",
)
async def handle_message(message: api_pb2.ChannelMessage):
if message.sender_id == client.client_id:
return
channel = await client.channels.fetch(message.channel_id)
await channel.send(content=ChannelMessageContent(t="Hello!"))
client.on_channel_message(handle_message)
async def main():
await client.login()
await asyncio.Event().wait()
asyncio.run(main())
Next Steps
-
:material-download:{ .lg .middle } Installation
Install the SDK using pip, poetry, or uv
-
:material-rocket-launch:{ .lg .middle } Quick Start
Build your first Mezon bot in minutes
-
:material-book-open-variant:{ .lg .middle } Guide
Learn about events, messaging, and more
-
:material-api:{ .lg .middle } API Reference
Complete API documentation