Async-Sync Python library for Fragment.com API (Telegram Premium, Stars, Usernames, Numbers, Gifts)
Project description
Fragment API Python
Professional Python library for Fragment.com automation
Fragment API Python — полная автоматизация Fragment.com: покупка Stars/Premium, розыгрыши, маркетплейс, ставки (bid), управление номерами. Sync + Async.
📚 Документация | 💬 Telegram чат
Возможности
- Sync / Async —
FragmentClientиAsyncFragmentClient - Покупки — Stars (50–10M), Premium (3/6/12 мес), TON Ads,
payment_method="ton"|"usdt_ton" - Розыгрыши — Stars и Premium для каналов
- Ставки (Bid) —
place_bid(item_type=1|3|5, slug, bid)— если ставка = цене выкупа, покупка моментальна - Маркетплейс — поиск username, numbers, gifts с фильтрами и пагинацией
- Wallet — V4R2 и V5R1 (W5)
- Авто-аутентификация — получение кук через TON кошелек и Telegram
- Anonymous numbers — управление кодами входа и завершение сессий
- Ошибки — полная иерархия exceptions, неизвестные ошибки просьба сообщать
Установка
pip install fragment-api-py[async] # sync + async
Быстрый старт
from FragmentAPI import FragmentClient
client = FragmentClient(
seed="24 слова...",
cookies={"stel_ssid": "...", "stel_token": "...", ...}
)
# Инфо кошелька
w = client.get_wallet()
print(f"{w.balance_ton} TON, {w.balance_usdt} USDT")
# Покупка Stars (USDT)
client.purchase_stars("@durov", 100, payment_method="usdt_ton")
# Покупка Premium (TON, показать отправителя)
client.purchase_premium("@durov", 6, show_sender=True)
# Ставка на username (тип 1)
client.place_bid(1, "username", bid=150) # 150 TON
# Розыгрыш Stars в канале
client.giveaway_stars("@channel", winners=5, amount=1000)
# Поиск в маркетплейсе
items = client.search_usernames("gold", filter="sale")
Авто-получение кук (функция authenticate)
from FragmentAPI import FragmentClient
# Автоматическая аутентификация через TON кошелек и Telegram
cookies = FragmentClient.authenticate(
seed="24 слова...",
wallet_version="V5R1",
telegram_phone="+71234567890" # или telegram_auth_data
)
client = FragmentClient(seed="...", cookies=cookies)
Async пример
from FragmentAPI import AsyncFragmentClient
async with AsyncFragmentClient(seed="...", cookies=...) as client:
wallet = await client.get_wallet()
result = await client.place_bid(3, "123456789", bid=50) # номер
Требования
- Python 3.10+
- Куки Fragment:
stel_ssid,stel_dt,stel_token,stel_ton_token - Сид-фраза TON кошелька
Сообщение об ошибках
При неизвестной ошибке — создавайте Issue или пишите в Telegram чат. Это поможет пополнить базу исключений.
Лицензия MIT
Project details
Release history Release notifications | RSS feed
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_api_py-5.0.1.tar.gz.
File metadata
- Download URL: fragment_api_py-5.0.1.tar.gz
- Upload date:
- Size: 31.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f7cf0c21a559d695f793747610e2d26640aca077919594ecfb8115d356be518
|
|
| MD5 |
b44ea5d74625fba180e81e005caa462c
|
|
| BLAKE2b-256 |
8107e9f7977ef3d74d5ef20ca5272e1ebc94556cce83346cd7d0d05d9ae7f4e5
|
File details
Details for the file fragment_api_py-5.0.1-py3-none-any.whl.
File metadata
- Download URL: fragment_api_py-5.0.1-py3-none-any.whl
- Upload date:
- Size: 46.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
224b4084588439ce16293f677da54430b2cdb2b84c68a5f8d19abf75e6befb20
|
|
| MD5 |
ce6426cfd02cc665e5261056fc713a97
|
|
| BLAKE2b-256 |
38e3ca99312e406e3a65f92c572d7387c46f1c9a288a09fd1f7c1fcb271886a1
|