Python client for the Fragment API
Project description
Fragment API Python Client
A Python client library for interacting with the Fragment API, which provides programmatic access to Telegram Stars, Premium, and TON services.
Installation
pip install fragment-api-py
Usage
from fragment_api import FragmentAPI
# Initialize client
client = FragmentAPI()
# Create authentication session
auth_response = client.create_auth(
wallet_mnemonic="word1 word2 word3 ...",
cookies="cookie1=value1; cookie2=value2",
hash_value="121ff4016366e2a38f"
)
# Check balance
balance = client.get_balance()
# Buy stars
stars_response = client.buy_stars("@username", quantity=50, show_sender=False)
# Gift premium
premium_response = client.gift_premium("@username", months=3, show_sender=False)
# Top up TON
ton_response = client.topup_ton("@username", amount=1, show_sender=False)
# Search users
stars_user = client.get_user_stars("@username")
premium_user = client.get_user_premium("@username")
# Check API health
health = client.health_check()
# Close session
client.close()
Features
- Session management with persistent auth_key
- Support for all Fragment API endpoints
- Error handling for API responses
- Type hints for better code completion
- Clean and intuitive interface
Requirements
- Python 3.7+
- requests>=2.28.0
License
MIT License
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
fragment_api_py-2.0.2.tar.gz
(4.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fragment_api_py-2.0.2.tar.gz.
File metadata
- Download URL: fragment_api_py-2.0.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5b75cfb0c567fec39ae48aeb7dcd8f9d8c03fb2c2b41e4ab5c41825db8245d0
|
|
| MD5 |
62554864736b7afb28da8c8b75f38d9a
|
|
| BLAKE2b-256 |
7bbcded1f45247e20b4a8f98a5e5ebc83005e059868e37f4abe6d56d32ee1279
|
File details
Details for the file fragment_api_py-2.0.2-py3-none-any.whl.
File metadata
- Download URL: fragment_api_py-2.0.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81b80a2001bad1f8ca9967344e28e97d8121cd336c3d8a40b2414aaaae96fd44
|
|
| MD5 |
035933d1b62da6ebed36b0bd6d92a01c
|
|
| BLAKE2b-256 |
409f1609899bfa0da4695bd8423454a6e633de09fd8f2b66e16f9f3617199766
|