Python SDK for Fragment API - Buy Telegram Stars and Premium
Project description
Fragment Stars API
Python SDK for purchasing Telegram Stars and Premium via Fragment API.
Installation
pip install fragment-stars-api
Quick Start
from fragment_api import FragmentAPIClient
client = FragmentAPIClient()
# Buy 50 stars (no KYC mode)
result = client.buy_stars("username", 50, seed="your_seed_base64")
print(f"Success: {result.success}")
# Buy 3 months premium
result = client.buy_premium("username", 3, seed="your_seed_base64")
# With KYC (lower commission)
result = client.buy_stars("username", 50, seed="...", cookies="cookies_base64")
Custom Server
client = FragmentAPIClient(base_url="https://your-server.com:8443")
Commission Rates
rates = client.get_rates()
print(f"No KYC: {rates.rate_no_kyc}%")
print(f"With KYC: {rates.rate_with_kyc}%")
API Reference
FragmentAPIClient(base_url, timeout, poll_timeout)
| Parameter | Type | Default | Description |
|---|---|---|---|
base_url |
str | https://fragment-api.ydns.eu:8443 |
API URL |
timeout |
float | 30.0 | Request timeout (seconds) |
poll_timeout |
float | 300.0 | Max wait for queue (seconds) |
buy_stars(username, amount, seed, cookies=None, wait=True)
Buy Telegram Stars.
| Parameter | Type | Required | Description |
|---|---|---|---|
username |
str | Yes | Telegram username |
amount |
int | Yes | Number of stars |
seed |
str | Yes | Wallet seed (base64) |
cookies |
str | No | Fragment cookies (base64) for KYC mode |
wait |
bool | No | Wait for result (default: True) |
buy_premium(username, duration, seed, cookies=None, wait=True)
Buy Telegram Premium.
| Parameter | Type | Required | Description |
|---|---|---|---|
username |
str | Yes | Telegram username |
duration |
int | Yes | Months (3, 6, or 12) |
seed |
str | Yes | Wallet seed (base64) |
cookies |
str | No | Fragment cookies (base64) for KYC mode |
wait |
bool | No | Wait for result (default: True) |
get_rates()
Get commission rates. Returns CommissionRatesResponse.
get_status(request_id)
Get request status. Returns QueuedRequest.
Exceptions
from fragment_api import FragmentAPIError, QueueTimeoutError
try:
result = client.buy_stars("username", 50, seed="...")
except QueueTimeoutError:
print("Request timed out")
except FragmentAPIError as e:
print(f"Error: {e.error_code} - {e.message}")
License
MIT
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
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_stars_api-1.1.0.tar.gz.
File metadata
- Download URL: fragment_stars_api-1.1.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b377a717a07f40f49702e86c5fcb2d5c1218372dffb67d8cc861520b3b013227
|
|
| MD5 |
1ffec296287633b035fe7fde99870312
|
|
| BLAKE2b-256 |
070537ea81fabd3b9a1c9a5fd8f0b357406898fc38607adfca6985e30c3b740c
|
File details
Details for the file fragment_stars_api-1.1.0-py3-none-any.whl.
File metadata
- Download URL: fragment_stars_api-1.1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3393a99bb9388a2d3c9a2e038602b1d387a7fa93bb35145a66eed8fa037aa34
|
|
| MD5 |
59ae894f17f2a5dcf592be7da24862e7
|
|
| BLAKE2b-256 |
5f0673584a6193d6f8d6ae0f13ba284a546fb3983a84b8ff1896e841c673e7f8
|