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.1.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.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tma_functions-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e129f8255185d893a7eab4bce5302728dcd776e16887c1f6bb49f68871e88271
MD5 635db24574707e4979ec4bb19a38df05
BLAKE2b-256 228fecc31d89bfc5b71bbd6a45d30469fd1093af0eca4225cd6df8432f0035a9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tma_functions-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 44a5df9435eb795f5e963c8f8bc7bf67ec28b082bcffd6088d270225a394b4d9
MD5 eb0b998f665439e518fbeca783f965f6
BLAKE2b-256 c503d3152b4f99d1e1f7263fb50c11b88c4f322483281f1cf22c3422a81f8a7e

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