Files
FragmentAPI/README.md
T

2.4 KiB

pyfragment

pyfragment

PyPI Downloads Python Tests License

Async Python client for the Fragment.com marketplace API.

Documentation · Examples

Disclaimer: This project is not affiliated with Fragment or Telegram.

Installation

pip install pyfragment
# Latest dev build
pip install git+https://github.com/bohd4nx/pyfragment.git@dev

Quick Start

import asyncio

from pyfragment import FragmentClient
from pyfragment.enums import PaymentMethod


async def main() -> None:
    async with FragmentClient(
        seed="word1 word2 ... word24",
        api_key="YOUR_API_KEY",
        cookies={"stel_ssid": "...", "stel_dt": "...", "stel_token": "...", "stel_ton_token": "..."},
    ) as client:
        wallet = await client.get_wallet()
        print(f"GRAM: {wallet.gram_balance} | USDT: {wallet.usdt_balance}")

        stars = await client.purchase_stars("@username", amount=500, payment_method=PaymentMethod.USDT_GRAM)
        print(f"Sent {stars.amount} Stars to {stars.username} | tx: {stars.transaction_id}")

        premium = await client.purchase_premium("@username", months=6, payment_method=PaymentMethod.GRAM)
        print(f"Sent Premium {premium.amount}m to {premium.username} | tx: {premium.transaction_id}")


asyncio.run(main())

Made with ❤️ by @bohd4nx · Changelog · Contributing · Security