Async Python client library for the Chatto webchat Connect API
Project description
chattolib
Unofficial async Python client library for the Chatto webchat API.
Chattolib versions track the Chatto server version they target. The current release targets Chatto's ConnectRPC API. Request/response traffic uses the official
connectrpcPython package; the realtime channel is a binary protobuf WebSocket at/api/realtime(needs the[realtime]extra).
Install
pip install chattolib
Quick start
import asyncio
from chattolib import ChattoClient
async def main():
# Public discovery — no auth required
async with ChattoClient() as anon:
profile, login = await anon.get_server()
print(f"Chatto {profile.version}: {profile.name}")
# Authenticated calls
async with await ChattoClient.login("username", "password") as client:
me = await client.me()
print(f"Logged in as {me.display_name}")
for entry in await client.list_rooms():
if entry.room:
print(f" - {entry.room.name}")
asyncio.run(main())
Realtime
Install with the extra:
pip install 'chattolib[realtime]'
Then stream live events:
from chattolib import stream_events
async with await ChattoClient.login("username", "password") as client:
async for event in stream_events(client):
print(event.kind, event.actor_id, event.payload)
event.kind names the protobuf oneof case (message_posted,
reaction_added, presence_changed, notification_created, …).
event.payload is the concrete protobuf sub-message — access its fields
directly (e.g. event.payload.room_id). Realtime events are invalidation
signals; use the corresponding Connect RPC (GetRoomEventsAround,
GetNotification, GetUser, …) to hydrate the referenced resource.
Escape hatch
ChattoClient.services exposes the underlying connectrpc service clients
directly (one per Chatto service), for anything the Pythonic wrappers don't
yet cover. For example:
from chattolib._pb.chatto.api.v1 import messages_pb2
resp = await client.services.messages.get_message(
messages_pb2.GetMessageRequest(room_id=..., event_id=...)
)
License
- chattolib's own code is licensed under MPL-2.0 (Mozilla Public License 2.0) — a weak, file-level copyleft. You can use, distribute, and embed chattolib in commercial or proprietary software; modifications to the library's own files must be released under MPL-2.0.
- Vendored Chatto protobuf definitions under
proto/chatto/**and the generated bindings undersrc/chattolib/_pb/chatto/**are Apache-2.0, matching upstreamchattocorp/chatto. - Vendored
buf.validatematerial is Apache-2.0 (frombufbuild/protovalidate).
See LICENSING.md for the full picture and REUSE.toml for the machine-readable licence map.
Note: chattolib versions 0.0.1 through 0.4.9 were released under MIT. Those releases remain MIT-licensed forever on PyPI; the MPL-2.0 relicence applies to newly published releases only.
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 chattolib-0.4.9.post1.tar.gz.
File metadata
- Download URL: chattolib-0.4.9.post1.tar.gz
- Upload date:
- Size: 138.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f21df3786d2585a09ea90b1fbd2f9457d707dcbcdcd875bb7f3923b4873e707b
|
|
| MD5 |
a0b787d89cbd1382b265742347988497
|
|
| BLAKE2b-256 |
56965db92fa215602eb98ac115eb3c45fe72025c71501b5f5745c3352ec3f8d7
|
File details
Details for the file chattolib-0.4.9.post1-py3-none-any.whl.
File metadata
- Download URL: chattolib-0.4.9.post1-py3-none-any.whl
- Upload date:
- Size: 176.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00245b93748d0d76f7269486fcb20462fdf1552e5746b5ae3e03602e8ef2ecd6
|
|
| MD5 |
997dbe298b6613383a0c6972cee3c297
|
|
| BLAKE2b-256 |
965d6c064d87b1cc112395bf0bd3ba62ad04fe583633be900ecf216219d1a0fa
|