Skip to main content

Helper functions for Telegram Mini Apps.

Project description

Telegram Mini App Helpers

A Python package with helper functions for Telegram Mini Apps.

Features

  • Validates initData from Telegram Mini Apps.
  • Modern Python packaging using pyproject.toml
  • Type hints and static type checking with mypy
  • Code formatting and linting with Ruff
  • Comprehensive testing setup
  • GitHub Actions for CI/CD

Installation

pip install tma-functions

Usage

from tma_functions.auth import validate_auth_data

# Example usage for auth data validation
bot_token = "YOUR_BOT_TOKEN"
auth_data = "auth_date=1678886400\nhash=YOUR_HASH\nquery_id=YOUR_QUERY_ID\nuser={\"id\":123,\"first_name\":\"John\",\"last_name\":\"Doe\",\"username\":\"john_doe\",\"language_code\":\"en\",\"allows_write_to_pm\":true,\"photo_url\":\"https://example.com/photo.jpg\"}"

is_valid = validate_auth_data(bot_token, auth_data)
print(f"Auth data valid: {is_valid}")

Development

This project uses modern Python development tools:

  • Hatch for project management
  • Ruff for linting and formatting
  • mypy for static type checking
  • pytest for testing

Setup Development Environment

  1. Install development dependencies:
pip install -e ".[dev]"
  1. Run tests:
pytest
  1. Run type checking:
mypy .
  1. Run linting:
ruff check .

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

tma_functions-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

tma_functions-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file tma_functions-0.1.0.tar.gz.

File metadata

  • Download URL: tma_functions-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for tma_functions-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ebdbc684a867f1cd0e4f5fdd079fa63ed86eff6ba0bb5346906ceb10600d1781
MD5 5d5fea82c04ec16cd2d87a0768c05231
BLAKE2b-256 cdb968db80447f0c92f99c91df38619c9edaf69fef310224695778e88d2cf9a3

See more details on using hashes here.

File details

Details for the file tma_functions-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tma_functions-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for tma_functions-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 796c4ed4e170f8499c7d4a8cf6d86f144c72b4cb48b533b14f82ecdea908bd71
MD5 21303aa8648da493d55f596dec3838c3
BLAKE2b-256 a056f6d1c55bd87706c86e5e460b21b9e92f29a218b3e6ec810157d5e830eb3a

See more details on using hashes here.

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