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.0.tar.gz
(8.3 kB
view details)
Built Distribution
File details
Details for the file anypay-1.1.0.tar.gz
.
File metadata
- Download URL: anypay-1.1.0.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 | 6e183c7a77c8e3a7385db3cd1919501cde26050df0bf5f4b6f6d33c58cbd2f0f |
|
MD5 | 92f6887d700845b994c14cd714d0dfc0 |
|
BLAKE2b-256 | c790e0abd0703ed20be00bd9d976cd7cfbca603115c1f4dc07495927ef3e5235 |
File details
Details for the file anypay-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: anypay-1.1.0-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 | bd08694b570151c303b856a34c3ea5aac08c2a94346da23abc05814fa2d1e42e |
|
MD5 | 12acfb36519ea1b81f3adbb8385bae42 |
|
BLAKE2b-256 | 8cfdad0b15b93740702865e5079431a25b3337d039e132c4fe967a9bac392c77 |