anore — Python SDK
Официальный SDK для приёма платежей через anore. Без зависимостей, только stdlib, Python 3.8+.
Структура
python/
├── pyproject.toml
└── anore/
├── __init__.py публичный экспорт
├── client.py AnoreClient — создание платежа, статус
├── _transport.py HTTP с ретраями/бэкоффом
├── webhooks.py verify_webhook / parse_webhook
├── models.py Payment, WebhookEvent
└── errors.py иерархия ошибок
Установка
pip install . из этой папки, либо скопируйте папку anore/ в проект.
from anore import AnoreClient, parse_webhook
Быстрый старт
anore = AnoreClient(api_key="an_live_xxxxxxxxxxxxxxxx")
# 1. создать счёт
payment = anore.create_payment(
amount=1500,
description="Подписка Pro",
order_id="order_42",
shop_id=1, # обязателен для аккаунтовых ключей (an_live_ / an_test_)
)
print(payment.payment_url) # отправьте клиента на форму оплаты
# 2. проверить статус
status = anore.get_payment(payment.id)
print(status.status, status.paid) # 'paid', True
Проверка вебхука
При оплате anore шлёт POST на ваш URL с заголовком Anore-Signature.
Проверяйте подпись по сырому телу запроса (не распарсенному JSON):
# Flask
from flask import Flask, request, abort
from anore import parse_webhook, SignatureError
import os
app = Flask(__name__)
@app.post("/webhook")
def webhook():
raw = request.get_data() # сырые байты, не request.json
sig = request.headers.get("Anore-Signature", "")
try:
event = parse_webhook(raw, sig, os.environ["ANORE_WEBHOOK_SECRET"])
except SignatureError:
abort(403)
if event.is_succeeded:
... # отгрузить заказ event.id / event.order_id
return {"ok": True}
Обработка ошибок
from anore import AnoreClient, ValidationError, AuthenticationError, APIConnectionError
try:
anore.create_payment(amount=1500, description="Заказ")
except ValidationError: # 400 — кривой запрос
...
except AuthenticationError: # 401 — неверный ключ
...
except APIConnectionError: # сеть недоступна
...
Справка
| API | Описание |
|---|---|
AnoreClient(api_key, secret=None, base_url=..., timeout=30, max_retries=2) |
клиент; secret подписывает исходящие запросы |
create_payment(amount, description, order_id=None, shop_id=None) |
создать счёт → Payment |
get_payment(id) |
статус → Payment (.status, .paid) |
verify_webhook(raw_body, signature, secret) |
проверка подписи → bool |
parse_webhook(raw_body, signature, secret) |
проверка + разбор → WebhookEvent (бросает SignatureError) |
Ошибки: ValidationError (400), AuthenticationError (401), ForbiddenError (403), NotFoundError (404), ServerError (5xx), APIConnectionError (сеть), SignatureError (подпись). База — AnoreError.
Полная документация: https://anore.cc/docs
Metadata
Release files for anore 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| anore-1.0.1.tar.gz | 10.0 kB | Without provenance | Details for anore-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anore-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for anore-1.0.1-py3-none-any.whl |
Total release size: 19.6 kB
Release files / anore-1.0.1.tar.gz
| Download URL | anore-1.0.1.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9f542ded058f7af259b034a190f95d8b88c63caf4ba0a231155e1e75fcdf199
|
|
BLAKE2b-256 checksum How to use checksums |
152e580fdb25ce97df5dd771ef3fcec89e16e0773c2eaf5a9b82dd693ea411d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Release files / anore-1.0.1-py3-none-any.whl
| Download URL | anore-1.0.1-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df52de90011db47b633316606b540255aea2662280f46de95efea3e50e804416
|
|
BLAKE2b-256 checksum How to use checksums |
792d9eea4f492b6ccc35ac0cbb789a87956e0628f6b919167ceea2026d742849
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Security for anore 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.