BaleClient
⚡ BaleClient is a maintained fork / rework of Aiobale, an asynchronous Python client for Bale Messenger.
The original library is great but contains several bugs and incomplete implementations. This project fixes those issues and adds improvements for reliability, stability, and usability.
Installation
Install from PyPI:
pip install baleclient
Upgrade to the latest version:
pip install -U baleclient
Install from source:
git clone https://github.com/Foad-KhAb/baleclient.git
cd baleclient
pip install -e .
Requirements
- Python 3.11+
Quick Example
from baleclient import Client
async def main():
async with Client("session") as client:
me = await client.get_me()
print(me)
Features
- Fully asynchronous API
- Lightweight and fast
- Improved parsing reliability
- Better error handling
- Maintained fork of Aiobale
Based On
This project is based on:
Aiobale https://github.com/Enalite/aiobale
Credit to the original author for the initial implementation.
Why BaleClient?
While using Aiobale in real projects, I encountered several issues such as:
- parsing bugs
- inconsistent API responses
- missing validations
- edge cases not handled
BaleClient fixes these problems and introduces improvements to make the library more stable for production usage.
Fixes
The following issues in the original library have been fixed:
- Fixed dialog response parsing
- Fixed message caption parsing
- Fixed history response validation errors
- Fixed incorrect type validations in response models
- Fixed document MIME type parsing when the API returns a dictionary instead of a string
- Fixed thumbnail parsing when the API returns
6-1instead of6 - Fixed thumbnail image parsing when the API returns a structured object instead of raw
bytesorstr - Allowed
GroupPeer.access_hashto be optional to support peers returned without an access hash
This list will continue to grow as more protocol inconsistencies are discovered and resolved.
Improvements
Additional enhancements and quality-of-life improvements:
- Improved error handling for corrupted or modified session files
- Improved robustness when parsing Bale API responses with inconsistent structures
- Added safer handling for missing or optional message fields
- Added normalization for inconsistent thumbnail payload structures
- Improved resilience against schema variations in document and media responses
Changelog
v0.1.0
- Initial release
- Fork of Aiobale with several fixes
- Improved session error handling
Documentation
Documentation will be expanded in future releases.
For now, refer to:
- The source code
- Example usage in the repository
Notes
- BaleClient is not an official Bale API library
- The Bale API is internal and may change without notice
License
This project follows the same license as the original project unless otherwise specified.
Metadata
Release files for BaleClient 1.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| baleclient-1.0.9.tar.gz | 110.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| baleclient-1.0.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 326.7 kB
Release files / baleclient-1.0.9.tar.gz
| Download URL | baleclient-1.0.9.tar.gz |
|---|---|
| Size | 110.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c22f96a0badaf5696ac73be35f069477b9fa4bed9f92cb923b7dd23551f49805
|
|
BLAKE2b-256 checksum How to use checksums |
a483f653a2cfa63148bbcb447cd7d988e32799d08e831c858df7b0bdf99cc4ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency logRelease files / baleclient-1.0.9-py3-none-any.whl
| Download URL | baleclient-1.0.9-py3-none-any.whl |
|---|---|
| Size | 216.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0dca74b6316dd6f888f8ed62673787212ec21c1d9acbe9fa1c55acc06218742e
|
|
BLAKE2b-256 checksum How to use checksums |
10f35bed151430d8dc689bbfb085eac76aea54337eb0ad1dc82bc16a56f78b7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency log