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 apifrag
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.3.tar.gz
(3.7 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.3.tar.gz.
File metadata
- Download URL: fragment_api_py-2.0.3.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f470bf78f39617b48cc1e0a5ce2dfbdf52c0c2706773b3ffc5c7420d0acabd7b
|
|
| MD5 |
bc11723dbc3cdaa868e3bad355b47ec8
|
|
| BLAKE2b-256 |
582fb5f0635c308de13694716493bdb4d864e4292faac0499c5a180e2dce5acc
|
File details
Details for the file fragment_api_py-2.0.3-py3-none-any.whl.
File metadata
- Download URL: fragment_api_py-2.0.3-py3-none-any.whl
- Upload date:
- Size: 4.1 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 |
cf30832377b480fca734d14414367f6acac3882891c677b674fdae746be8443c
|
|
| MD5 |
4d6775a98441e09c6b66b8b783d15b95
|
|
| BLAKE2b-256 |
522579668dfc94389fac0466487076e985c7e58917bfacff9f217d68fa0c5df7
|