mirror of
https://github.com/vibe-existing/pyfragment.git
synced 2026-07-25 06:54:31 +00:00
4.8 KiB
4.8 KiB
Changelog
All notable changes to pyfragment are documented in this file.
The format is based on Keep a Changelog,
and this project uses Calendar Versioning (YYYY.MINOR.MICRO).
[Unreleased]
Added
Giveaways
giveaway_stars(channel, winners, amount)— run a Telegram Stars giveaway for a channel (1–5 winners, 500–1 000 000 stars each); raisesUserNotFoundErrorif the channel is not found on Fragment,ConfigurationErrorifwinnersoramountare out of rangegiveaway_premium(channel, winners, months)— run a Telegram Premium giveaway for a channel (1–24 000 winners, 3/6/12 months each); raisesUserNotFoundErrorif the channel is not found on Fragment,ConfigurationErrorifwinnersormonthsare invalidStarsGiveawayResultandPremiumGiveawayResultresult types
Raw API access
FragmentClient.call(method, data, *, page_url)— send a raw request to any Fragment API method without waiting for a library updateFRAGMENT_BASE_URLconstant — single source of truth for the Fragment base URL used across all page constants and headers
Anonymous number management
get_login_code(number)— fetch the current pending login code for an anonymous numbertoggle_login_codes(number, can_receive)— enable or disable login code delivery for an anonymous numberterminate_sessions(number)— terminate all active Telegram sessions for an anonymous number (two-step flow handled internally)LoginCodeResultandTerminateSessionsResultresult typesAnonymousNumberErrorexception — raised when a number is not owned or session termination fails
Examples
examples/giveaway_stars.py— Stars giveaway withUserNotFoundError/ConfigurationErrorhandlingexamples/giveaway_premium.py— Premium giveaway withUserNotFoundError/ConfigurationErrorhandlingexamples/call.py— raw API call viaclient.call()examples/anonymous_number.py— login code fetch and session termination withAnonymousNumberErrorhandling
Changed
- All result types (
PremiumResult,StarsResult,StarsGiveawayResult,PremiumGiveawayResult) now use a single unifiedamountfield instead ofmonths,stars— consistent API across every method __repr__on result types now includes the unit (3 months,500 stars) for clarity- Method module files renamed to match their function:
premium.py→purchase_premium.py,stars.py→purchase_stars.py,ton.py→topup_ton.py timestampfield removed from all result dataclasses- All page URL constants (
STARS_PAGE,PREMIUM_PAGE, etc.) now built fromFRAGMENT_BASE_URLinstead of hardcoded strings TransactionErrornow includes an SSL hint when a broadcast fails due to certificate verification errorsTransactionError.DUPLICATE_SEQNO— dedicated error raised after 3 failed attempts due to a406 Duplicate msg_seqnoresponse from the TON network; broadcast is automatically retried (up to 2 retries, 2 s apart) before giving up- All error message templates rewritten to follow a "what happened → why → what to do" pattern — every template is now actionable and includes a fix hint where applicable
2026.0.2 — 2026-03-20
Added
timeoutparameter onFragmentClient(default30.0s) — passed through to every HTTP request
Changed
- Cookie validation: narrowed type internally so no
# type: ignoreis needed inFragmentClient.__init__ WALLET_CLASSEStyped asdict[str, Any]so mypy resolvesfrom_mnemoniccorrectly- All four
examples/files updated toasync with FragmentClient, f-strings, and aligned error messages - README usage section rewritten with a single comprehensive
async withexample
Fixed
- mypy: missing return path in
process_transactionafter retry loop - mypy:
cookiesunion-attr error inFragmentClient.__init__
2026.0.1 — 2026-03-16
Added
- Initial stable release of
pyfragment FragmentClient— async client for the Fragment.com API with context manager support (async with)purchase_premium(username, months)— purchase Telegram Premium for any user (3, 6, or 12 months)purchase_stars(username, amount)— send Telegram Stars to any user (50–1,000,000)topup_ton(username, amount)— top up TON Ads balance (1–1,000,000,000 TON)get_wallet()— fetch wallet address and balance- Support for TON wallet versions
V4R2andV5R1 - Structured exception hierarchy (
FragmentError,ConfigurationError,CookieError, etc.) py.typedmarker — full PEP 561 typing support for type-checkers__repr__on all result types for readable debug output