Skip to content

phuvinh010701/mezon-sdk-python

Repository files navigation

Mezon SDK Python

PyPI version Python Support License

A Python SDK for building bots and applications on the Mezon platform. Async-first, type-safe, and production-ready.

Installation

pip install mezon-sdk

Quick Start

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())

Documentation

Full documentation: https://docs.laptrinhai.id.vn/

Features

  • Async/await native with asyncio
  • Real-time WebSocket with auto-reconnection
  • Type-safe with Pydantic models
  • Event-driven architecture
  • Interactive messages (buttons, forms)
  • Token sending support
  • Message caching with SQLite

Links

License

Apache License 2.0 - see LICENSE for details.

About

Mezon Python SDK for realtime messaging and APIs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages