Skip to main content

Async AAIO api wrapper for python

Project description

AAIO API for Python 3

About

This library is a wrapper for the https://aaio.io API from enthusiasts. All methods are described and all types are explicitly defined. The library does not handle any exceptions, so be careful. Methods that create requests to aaio.io return a pydantic's models for each response. Please write about all problems related to the library to issues

API is up-to-date as of 29 October 2023.

Features

  • It's completely asynchronous
  • Uses single aiohttp session to improve performance
  • You can use multiple clients to work with multiple users or shops
  • All methods for working with API are implemented
  • The library returns strictly typed for responses from APIs
  • For each method, docstrings are used
  • The library handle {type: error} responses and throws AAIOBadRequest exception
  • Our library was the first to be added to the official AAIO wiki
  • Modern, strict code for Python 3.7

Library Installation

  • Install via pip: pip install aaio
  • Download sources - git clone https://github.com/kewldan/AAIO

Getting Started

Get user balance

Note that the AAIO constructor is called in the async function! Problem related to calling in sync function

import asyncio

from aaio import AAIO


async def main():
    client = AAIO('MERCHANT ID', 'SECRET KEY', 'API KEY')
    balances = await client.get_balances()
    print(balances)  # type='success' code=None message=None balance=625.85 referral=172.96 hold=0.0


asyncio.run(main())

Create payment URL for customer

import asyncio

from aaio import AAIO


async def main():
  client = AAIO('MERCHANT ID', 'SECRET KEY', 'API KEY')
  payment_url = client.create_payment(100, 'my_order_id', 'My order description', 'qiwi', 'support@aaio.io',
                                      'referral code', currency='USD',
                                      language='en')
  print(payment_url)  # Prints payment url for customer


asyncio.run(main())

Create payoff

import asyncio

from aaio import AAIO


async def main():
  client = AAIO('MERCHANT ID', 'SECRET KEY', 'API KEY')
  payoff = await client.create_payoff('qiwi', 100.35, '79998887766', 'my_payoff_id')
  print(payoff.status)  # in_progress


asyncio.run(main())

The session is closed automatically when the object is deleted (when __del__() is called)

Contact

E-Mail - kewldanil1@gmail.com Telegram - @kewldan

License

Released under MIT by @kewldan.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aaio-1.2.0.tar.gz (9.5 kB view hashes)

Uploaded Source

Built Distribution

aaio-1.2.0-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page