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.4-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: loya_client-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 2.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 25447e666fc017f91b7c5e97336bb0e60d67bf29e8426994389630087080af23
MD5 d0fe96da8928676e1d588b2ba1fd2574
BLAKE2b-256 4049018fad61f8a49c7825ddc8139493ea0bbfeb1968b2b10067c0e2694fd32d

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