Python client for https://api.cristalix.gg
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
Cristalix API (Python)
Клиентская библиотека для https://api.cristalix.gg с аккуратным API и нормальной типизацией. Подходит и для быстрых запросов, и для асинхронных сценариев.
Что внутри
- Синхронный и асинхронный клиент.
- Типизированные модели ответов.
- Проверка параметров на стороне клиента.
Установка
pip install httpx[http2]
Быстрый старт (sync)
from cristalixtop import CristalixClient
client = CristalixClient(
project_key="YOUR_PROJECT_KEY",
token="YOUR_TOKEN",
)
profile = client.get_profile_by_name("LisoMandiy")
print(profile)
client.close()
Контекстный менеджер
from cristalixtop import CristalixClient
with CristalixClient(project_key="YOUR_PROJECT_KEY", token="YOUR_TOKEN") as client:
profiles = client.get_profiles_by_names(["LisoMandiy", "kkp_"])
print(profiles)
Асинхронный клиент
import asyncio
import httpx
from cristalixtop import AsyncCristalixClient
async def main() -> None:
limits = httpx.Limits(max_connections=100, max_keepalive_connections=20)
async with AsyncCristalixClient(
project_key="YOUR_PROJECT_KEY",
token="YOUR_TOKEN",
limits=limits,
) as client:
profile = await client.get_profile_by_name("LisoMandiy")
print(profile)
asyncio.run(main())
Настройка клиента
from cristalixtop import CristalixClient
client = CristalixClient(
project_key="YOUR_PROJECT_KEY",
token="YOUR_TOKEN",
enforce_http2=True,
max_retries=2,
timeout=10.0,
)
Обработка ошибок
from cristalixtop import (
CristalixClient,
CristalixHTTPError,
CristalixRateLimitError,
CristalixValidationError,
)
try:
with CristalixClient(project_key="YOUR_PROJECT_KEY", token="YOUR_TOKEN") as client:
client.get_profile_by_name("LisoMandiy")
except CristalixRateLimitError as exc:
print("Rate limited:", exc.status_code)
except CristalixHTTPError as exc:
print("HTTP error:", exc.status_code, exc.payload)
except CristalixValidationError as exc:
print("Bad input:", exc)
Методы
get_profiles_by_names(names)— профили по списку никнеймов (до 50).get_profile_by_name(name)— профиль по никнейму.get_profiles_by_ids(ids)— профили по списку UUID (до 50).get_profile_by_id(player_id)— профиль по UUID.get_profile_reactions(player_id)— лайки/дизлайки профиля.get_friends(player_id, skip=0, limit=25)— список друзей с пагинацией.get_subscriptions(player_id, skip=0, limit=25)— подписчики с пагинацией.get_profile_activity_statistics(player_id)— активность по играм за текущий день.get_all_profile_statistics(player_id)— вся статистика по всем периодам.get_profile_statistics(player_id)— общая статистика без периодов.games_list()— список игр и режимов.read_by_time_rating(time, game_id, mode_key, sub_mode_key, sort_field, season_key)— лидерборд по периоду.
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 Distribution
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
File details
Details for the file cristalixtop-1.0.0.tar.gz.
File metadata
- Download URL: cristalixtop-1.0.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bdf65d17169720e2b2901968a32f0f968968629cf71e2db2b9079800742971c
|
|
| MD5 |
2c0caf8f30106003dcea2c25afaf0d45
|
|
| BLAKE2b-256 |
ab756e663ddf2e5a15863ffa14269153d5d12267bb49380e196dd3ed0049a6dd
|
File details
Details for the file cristalixtop-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cristalixtop-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aa802e344f14b31241d948fbcabd9ef88326bb4cae1ee520180b55e449f6ef1
|
|
| MD5 |
cccea4d754b9e187ff4e172620cb2dc1
|
|
| BLAKE2b-256 |
3f27ece8be26bb456a1e261dac7ff396f0888a2bdf07c998a7063d83c1562406
|