Skip to main content

No project description provided

Project description

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-1 instead of 6
  • Fixed thumbnail image parsing when the API returns a structured object instead of raw bytes or str
  • Allowed GroupPeer.access_hash to 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baleclient-1.0.5.tar.gz (110.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baleclient-1.0.5-py3-none-any.whl (216.2 kB view details)

Uploaded Python 3

File details

Details for the file baleclient-1.0.5.tar.gz.

File metadata

  • Download URL: baleclient-1.0.5.tar.gz
  • Upload date:
  • Size: 110.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for baleclient-1.0.5.tar.gz
Algorithm Hash digest
SHA256 1b93f14b983f78977da6e6c3b80717fe19f36832b6dfa242c6053c5262049a0b
MD5 edca306c6be83d5df696bc5ef3804af0
BLAKE2b-256 a1a4a04117f87985513b9bb9e3ec83055c816f85f0533b52482fb8ecdff42b1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for baleclient-1.0.5.tar.gz:

Publisher: workflow.yml on Foad-KhAb/baleclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file baleclient-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: baleclient-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 216.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for baleclient-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c0f1aba4d581f18b52ad865d39e2c164e5b4235b905d82367d1f3b03d4393a33
MD5 5f87eedec1153b0be5da21b180d4373f
BLAKE2b-256 17c5d22dac654f22f78666e345215729ef47eab1b2d1cf392794cd906e9d036b

See more details on using hashes here.

Provenance

The following attestation bundles were made for baleclient-1.0.5-py3-none-any.whl:

Publisher: workflow.yml on Foad-KhAb/baleclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page