Quick start

Simple template

Firstly, you need to import package

import asyncio

from glQiwiApi import QiwiWrapper

Create a new async function with instance of QiwiWrapper.

Caution

Context Manager in glQiwiApi. If you will not be using a library with a context manager or if you are using a sync adapter you must pass without_context = True

async def main():
    # If you want to use types wrapper without async context just
    # pass on "without_context=True"
    wallet = QiwiWrapper(
        api_access_token='your_token',
        phone_number='+number',
        without_context=True
    )

Get your balance, using get_balance() method

    print((await wallet.get_balance()).amount)

Note

Change from 0.2.0+ version. You can use the async context manager from the 0.2.0 version of the API. This improves performance if many functions are called in 1 block of the context call.

async def main_boost():
    # OR(x3 performance boost with async context,
    # because it use only 1 aiohttp session to get response for all requests
    # in async with context manager)
    async with QiwiWrapper(api_access_token='your_token') as w:
        w.phone_number = '+number'
        # Данным вызовом вы получите текущий баланс кошелька.
        print((await w.get_balance()).amount)