Async Python library for Fragment.com API with seqno/balance confirmation and confirmReq
Project description
Fragment API Python
Professional Python library for Fragment.com automation
Fragment API Python — complete Fragment.com automation: purchase Stars/Premium, giveaways, marketplace, bids, number management. Async-only.
📚 Documentation | 💬 Telegram Chat
Features
- Async-only —
FragmentClientwith full async/await support - Purchases — Stars (50–10M), Premium (3/6/12 months), TON Ads,
payment_method="ton"|"usdt_ton" - Giveaways — Stars and Premium for channels
- Bids —
place_bid(item_type=1|3|5, slug, bid)— if bid equals buy-now price, purchase is instant - Marketplace — search usernames, numbers, gifts with filters and pagination
- Wallet — V4R2 and V5R1 (W5) support
- Auto-authentication — obtain cookies via TON wallet and Telegram
- Anonymous numbers — manage login codes and terminate sessions
- NFT Management — withdraw gifts to wallet, transfer to other users
- Stars Revenue — withdraw earned Stars to wallet
- Errors — complete exception hierarchy; report unknown errors via issues
Installation
pip install fragment-api-py
Quick Start
import asyncio
from FragmentAPI import FragmentClient
async def main():
client = FragmentClient(
seed="24 words...",
cookies={"stel_ssid": "...", "stel_token": "...", ...}
)
# Wallet info
w = await client.get_wallet()
print(f"{w.balance_ton} TON, {w.balance_usdt} USDT")
# Purchase Stars (USDT)
await client.purchase_stars("@durov", 100, payment_method="usdt_ton")
# Purchase Premium (TON, show sender)
await client.purchase_premium("@durov", 6, show_sender=True)
# Place bid on username (type 1)
await client.place_bid(1, "username", bid=150) # 150 TON
# Stars giveaway in channel
await client.giveaway_stars("@channel", winners=5, amount=1000)
# Search marketplace
items = await client.search_usernames("gold", filter="sale")
asyncio.run(main())
Auto-cookie Authentication (authenticate method)
import asyncio
from FragmentAPI import FragmentClient
async def main():
# Automatic authentication via TON wallet and Telegram
cookies = await FragmentClient.authenticate(
seed="24 words...",
wallet_version="V5R1",
telegram_phone="+71234567890" # or telegram_auth_data
)
client = FragmentClient(seed="...", cookies=cookies)
asyncio.run(main())
Async Context Manager
import asyncio
from FragmentAPI import FragmentClient
async def main():
async with FragmentClient(seed="...", cookies=...) as client:
wallet = await client.get_wallet()
result = await client.place_bid(3, "123456789", bid=50) # number
asyncio.run(main())
Requirements
- Python 3.10+
- Fragment cookies:
stel_ssid,stel_dt,stel_token,stel_ton_token - TON wallet seed phrase
Reporting Errors
For unknown errors — create an Issue or message in Telegram chat. This helps expand the exception database.
MIT License
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-6.1.0.tar.gz.
File metadata
- Download URL: fragment_api_py-6.1.0.tar.gz
- Upload date:
- Size: 38.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c68d2829615492984bee77de8cb97b4f6a56de5bb1b0f9794ccc92d42224fb42
|
|
| MD5 |
be4591c6ad9172b0fcef5259d6585b65
|
|
| BLAKE2b-256 |
341d900bbeb1195dd0a1b7888c588a97a33c8998f69bee0f5b098784a135cefd
|
File details
Details for the file fragment_api_py-6.1.0-py3-none-any.whl.
File metadata
- Download URL: fragment_api_py-6.1.0-py3-none-any.whl
- Upload date:
- Size: 49.6 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 |
a2373adc4f17165b08104bdbf85abf662a23e888e3c7d0f4232356218a4811f7
|
|
| MD5 |
9cfac437feef67cb49035eab4fe1a3d5
|
|
| BLAKE2b-256 |
6ff08f810d0ca3e769d2dbdf7bfbf7ad12314e5adaca7ea0596b82cc2f2cb363
|