Asynchronous AnyPay API wrapper
Project description
A simple, yet powerful library for AnyPay API
Usage
With AnyPayAPI
you can easily create and retrieve payment and payout info, get informaition about your account's balance and commissions, etc.
Documentation
Official docs can be found on the API's webpage
Installation
pip install anypay
Requirements
Python 3.7+
httpx
pydantic
Features
Asynchronous
Exception handling
Pydantic return model
LightWeight
Basic example
import asyncio
from anypay import AnyPayAPI, AnyPayAPIError
api = AnyPayAPI(
'api_id', 'api_key', check=False, # you can disable credentials check
)
async def main():
try:
await api.get_balance()
except AnyPayAPIError as exc:
print(exc)
payments = await api.get_payments(project_id=1) # project_id can be provided in __init__
print(payments[0].id, payments[0].status)
bill = await api.create_payment(
pay_id=1234,
project_id=1,
method='qiwi',
email='test@mail.ru',
amount=100,
currency='RUB',
description='Test payment',
)
print(bill.id, bill.url)
bill = await api.create_bill( # easier way to create payment via SCI
pay_id=1234,
amount=100,
project_id=1,
project_secret='abcd',
)
print(bill.id, bill.url)
#get balance via property (sync)
print(api.balance)
asyncio.run(main())
Developed by Nikita Minaev (c) 2023
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
anypay-1.1.2.tar.gz
(8.3 kB
view details)
Built Distribution
File details
Details for the file anypay-1.1.2.tar.gz
.
File metadata
- Download URL: anypay-1.1.2.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc8afb79e5ec467d64e71865b1fa53469efb9251c5e9162daca76ea965441364 |
|
MD5 | 4544820b35413f01315060a3119e1381 |
|
BLAKE2b-256 | 7efe2fb6c794a5e3be17461220764d375bdeb97532d32b4a501c08da0957d7b7 |
File details
Details for the file anypay-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: anypay-1.1.2-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1615e604a3dda70509a4788d17e60ad4014bd710021c50bd0eb6149d18479b1d |
|
MD5 | 397bde28c9e4135c559e50eec907ffc8 |
|
BLAKE2b-256 | fad3d667d41b7731d700dc7fe2649e5ed4797c8ba7ff5bf9a201c3c84223603b |