Skip to main content

Async Python library for Fragment.com API with seqno/balance confirmation and confirmReq

Project description

Fragment API Python

Fragment API Python

Professional Python library for Fragment.com automation

PyPI Python Versions PyPI Downloads Telegram License


Fragment API Python — complete Fragment.com automation: purchase Stars/Premium, giveaways, marketplace, bids, number management. Async-only.

📚 Documentation | 💬 Telegram Chat


Features

  • Async-onlyFragmentClient with 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
  • Bidsplace_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


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-6.1.0.tar.gz (38.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fragment_api_py-6.1.0-py3-none-any.whl (49.6 kB view details)

Uploaded Python 3

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

Hashes for fragment_api_py-6.1.0.tar.gz
Algorithm Hash digest
SHA256 c68d2829615492984bee77de8cb97b4f6a56de5bb1b0f9794ccc92d42224fb42
MD5 be4591c6ad9172b0fcef5259d6585b65
BLAKE2b-256 341d900bbeb1195dd0a1b7888c588a97a33c8998f69bee0f5b098784a135cefd

See more details on using hashes here.

File details

Details for the file fragment_api_py-6.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fragment_api_py-6.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2373adc4f17165b08104bdbf85abf662a23e888e3c7d0f4232356218a4811f7
MD5 9cfac437feef67cb49035eab4fe1a3d5
BLAKE2b-256 6ff08f810d0ca3e769d2dbdf7bfbf7ad12314e5adaca7ea0596b82cc2f2cb363

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page