Skip to main content

Python библиотека для работы с xGift API

Project description

xgift - Python библиотека для работы с xGift API

Простая и удобная библиотека для получения информации о NFT-гифтах с платформы xGift.

PyPI: https://pypi.org/project/xgift/

GitHub: https://github.com/aiofake/xgift

Установка

pip install xgift

Быстрый старт

Пример 1: Получить цену гифта

import asyncio
from xgift import Gift

async def main():
    client = Gift()
    price = await client.floorPrice("PlushPepe")
    print(f"PlushPepe floor price: {price} TON")
    await client.close()

asyncio.run(main())

Пример 2: Получить информацию о нескольких гифтах

import asyncio
from xgift import Gift

async def main():
    client = Gift()
    
    gifts = ["PlushPepe", "AstralShard"]
    prices = await client.floorPrice(gifts)
    
    for gift, price in zip(gifts, prices):
        print(f"{gift}: {price} TON")
    
    await client.close()

asyncio.run(main())

Основные методы

Класс Gift

import asyncio
from xgift import Gift

async def main():
    client = Gift()
    
    # Получить floor price
    price = await client.floorPrice("PlushPepe")
    
    # Получить оценочную цену
    estimated_ton = await client.estimatedPrice("PlushPepe-1", asset="Ton")
    estimated_usd = await client.estimatedPrice("PlushPepe-1", asset="Usd")
    
    # Получить элементы коллекции
    models = await client.models_floor("PlushPepe")
    backdrops = await client.backdrops_floor("PlushPepe")
    symbols = await client.symbols_floor("PlushPepe")
    
    # График цены
    graph = await client.getFloorGraph("PlushPepe")
    
    # Проверка монохромности
    is_mono = await client.isMonochrome("PlushPepe-1")
    
    print(f"Price: {price}")
    await client.close()

asyncio.run(main())

Класс GiftRaw (низкоуровневый API)

import asyncio
from xgift import GiftRaw

async def main():
    raw = GiftRaw()
    
    # Прямые запросы к API
    gift_info = await raw.GiftInfo("PlushPepe-1")
    collection_info = await raw.CollectionInfo("PlushPepe")
    gifts_in_collection = await raw.CollectionGifts("PlushPepe")
    
    print(gift_info)
    await raw.close()

asyncio.run(main())

Утилиты

import asyncio
from xgift import tonRate, nfts, lottie

async def main():
    # Курс TON
    rate = await tonRate()
    print(f"TON rate: {rate}")
    
    # NFT
    names = await nfts("names")  # только names
    ids = await nfts("ids")      # только ids
    all_nfts = await nfts("all") # names + ids (по умолчанию)
    print(names)
    
    # Lottie анимация
    animation = await lottie("plushpepe-1")
    print(animation)

asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

xgift-0.3.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file xgift-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: xgift-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for xgift-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33438490e5a3da01befdeac063c6887065869fdc6f3a49abcdf4fcfb3d83ab69
MD5 b4fa7d44dbb75b6a88f67d498e43f8dc
BLAKE2b-256 caadc1647cf9de78d2afe0c8f09b6b8bbc320a77c40850d6106c1cfbcc13e66e

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