Асинхронный клиент для 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.21.tar.gz
(31.6 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.21.tar.gz.
File metadata
- Download URL: loya_client-0.2.21.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2dee4c8eddda6da16ab711c005c87359dc01bd41cf5b49ab4aa4b436146e314
|
|
| MD5 |
612f104311695d0f41626ab0e7d9fe21
|
|
| BLAKE2b-256 |
9cc34236e2c5f9c331f37dba4eb6473f8ec38ed9ba0e03ffd5dd8146b0d3852b
|
File details
Details for the file loya_client-0.2.21-py3-none-any.whl.
File metadata
- Download URL: loya_client-0.2.21-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bdcb99ef4f8104360ea41e8b6bfe8db2ea9218544cd6c6453ebc5421ddf4a18
|
|
| MD5 |
ccc94b650c2cd9ff737c34874641bc03
|
|
| BLAKE2b-256 |
2c6e2f71fa36e787675164ac21796b0d8c65db131e058e19226364ffe1f4c44b
|