Telegram Mini App Helpers
A Python package with helper functions for Telegram Mini Apps.
Features
- Validates
initDatafrom 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\"}"
user_data = validate_auth_data(bot_token, auth_data)
if user_data is not None:
print(f"User ID: {user_data['id']}")
print(f"Username: {user_data['username']}")
print(f"Full name: {user_data['first_name']} {user_data['last_name']}")
print(f"Language: {user_data['language_code']}")
else:
print("Invalid auth data")
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
- Install development dependencies:
pip install -e ".[dev]"
- Run tests:
pytest
- Run type checking:
mypy .
- Run linting:
ruff check .
Deploy
rm -rf ./dist
hatch build
twine upload ./dist/*
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for tma-functions 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tma_functions-0.1.2.tar.gz | 5.7 kB | Without provenance | Details for tma_functions-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tma_functions-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for tma_functions-0.1.2-py3-none-any.whl |
Total release size: 10.5 kB
Release files / tma_functions-0.1.2.tar.gz
| Download URL | tma_functions-0.1.2.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81383555bb061e17112e5223ea9b2335f729a9f37d1d53e17339e354c22c2aa7
|
|
BLAKE2b-256 checksum How to use checksums |
71010531ef51a6ebd55cbca3ba5fa42b5d1b8f6219aafa2c4650ebdb355c3921
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|
Release files / tma_functions-0.1.2-py3-none-any.whl
| Download URL | tma_functions-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce9d1471f32d49772c51bf2d472421c7d6fd1da874069ad78ff5ce90c2acb940
|
|
BLAKE2b-256 checksum How to use checksums |
7bf14dd84bf228692f233c3f39d9bcfa0e717337a24de3edded55d6b75fa05e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|
Security for tma-functions 0.1.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.