Skip to main content

Асинхронный клиент для Loya Loyalty API

Project description

loya-client

Асинхронный Python-клиент для Loya Loyalty API с автоматической авторизацией через PLAY2AUTH_SESS_ID.

Установка

pip install loya-client

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

from functools import lru_cache
from loya_client import LoyaClient, LoyaClientConfig
import os


@lru_cache()
def get_loya_client() -> LoyaClient:
    config = LoyaClientConfig(
            base_url=os.getenv("LOYA_BASE_URL", "http://loya-backend:9000"),
            email=os.getenv("LOYA_EMAIL", "apiuser@example.com"),
            password_hash=os.getenv(
                "LOYA_PASSWORD_HASH", "hash"
            ),
            apikey=os.getenv("LOYA_APIKEY", "apikey"),
            timeout=float(os.getenv("LOYA_TIMEOUT", "20.0")),
        )

    return LoyaClient(config)

client = get_loya_client()
card = await client.get_card_by_number("7770000002302")
print(card)

Особенности

  • Автоматический логин и релогин
  • Поддержка сессий через куки
  • Чистый, модульный код
  • Полная поддержка async/await
  • Готов к использованию в FastAPI

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.

loya_client-0.2.8-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file loya_client-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: loya_client-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for loya_client-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6e3f0635b2e1808a5e4e37e3cae4cebd0097e39b5e566c7aa9dced3d289341e6
MD5 179d1126dd54eefc59d590381e2c8b63
BLAKE2b-256 66ca83d2c523cc670be6f36ef096f9152195c39a3c482ece4d24c190e5eaab02

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