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", "Bitcoin"]
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-to-ids
ids = await nfts("ids") # ids-to-names
print(names)
# Lottie анимация
animation = await lottie("plushpepe-1")
print(animation)
asyncio.run(main())
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
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
xgift-0.2.2-py3-none-any.whl
(6.9 kB
view details)
File details
Details for the file xgift-0.2.2-py3-none-any.whl.
File metadata
- Download URL: xgift-0.2.2-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
287ba50458924d8e06915389bc9c80641722b92579ad5d9970f03a9d559559cf
|
|
| MD5 |
37927a5090e09ac3443a9d0bd911337e
|
|
| BLAKE2b-256 |
8e35d39699d1b5911ab7b872bb2c9f326d0583b096c3e111bcb18279c1eabe29
|