Асинхронный клиент для 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.19.tar.gz
(30.9 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.19.tar.gz.
File metadata
- Download URL: loya_client-0.2.19.tar.gz
- Upload date:
- Size: 30.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc9c9b8eb67d186d427ad82cb34ee7d78110729dc231be0ecc7d43b0c011a352
|
|
| MD5 |
05b7f9d1d9a34660d3aa2f72cf6923d2
|
|
| BLAKE2b-256 |
284f5bf879deb3d98da474545d6a3ebe26ba28517893da6910a4109ab004ed2f
|
File details
Details for the file loya_client-0.2.19-py3-none-any.whl.
File metadata
- Download URL: loya_client-0.2.19-py3-none-any.whl
- Upload date:
- Size: 28.1 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 |
b69240b919eae36366c507fb80ac30fe920391c6e9e7421afef8b9ba7317b92b
|
|
| MD5 |
57be10303b499b11ca544a5ce8e25732
|
|
| BLAKE2b-256 |
2c7511e5eba389cef033516ad4c7c4452c438253df4179ca216e29b962cda50d
|