Асинхронный клиент для 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
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
loya_client-0.2.17.tar.gz
(30.8 kB
view details)
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 loya_client-0.2.17.tar.gz.
File metadata
- Download URL: loya_client-0.2.17.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71e68242c3c517c3083f5023286e363e4ed604458129ea41bd77f485472fafbc
|
|
| MD5 |
a4362a06eb44cb1d74521801d11d999c
|
|
| BLAKE2b-256 |
5dcd71f61028bbca1a30a01fa34c11c100f1e36d81f54f014d558ed48fb518ee
|
File details
Details for the file loya_client-0.2.17-py3-none-any.whl.
File metadata
- Download URL: loya_client-0.2.17-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad938691a3c1a2cdbe9e3dad9d78d9f4f42e6de33f44e9d0900e319a2bada7e9
|
|
| MD5 |
2d049a0aed0737ea74cd9afe9dd496f2
|
|
| BLAKE2b-256 |
9aa8540da1cb82e56f88f732b6b9691079a762f98f46c180be260ca8efef74dc
|