- Saved searches
- Use saved searches to filter your results more quickly
- License
- mostm/pyqiwi
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.rst
- aioqiwi 1.1.5
- 🔥 Qiwi API p2p transactions(bills)
- 💳 Handling bill payments
- 🗺 QIWI terminals
- Connectors
- Hacking connector
- 👾 Handling errors
- API request error
- TimeoutError
- ⛏ return policies (types)
- ❓ HOW-TOs
- 🔧 TODOs
- Work in progress
- 🐦 Community
- Saved searches
- Use saved searches to filter your results more quickly
- License
- adilkhash/qiwi
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Saved searches
- Use saved searches to filter your results more quickly
- License
- aqur1n/aioqiwi
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- readme.rst
- About
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
License
mostm/pyqiwi
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.rst
- Оплата любых услуг
- Переводы на любой Qiwi Кошелек
- Статистика по платежам
- История о сделанных платежах в любой промежуток времени
- Прохождение упрощенной идентификации
- Определение провайдера мобильного телефона
- Получение текущего курса валют
import pyqiwi wallet = pyqiwi.Wallet(token='', number='79001234567')
payment = wallet.send(pid=99, recipient='79001234567', amount=1.11, comment='Привет!') example = 'Payment is \nRecipient: \nPayment Sum: '.format( payment.transaction['state']['code'], payment.fields['account'], payment.sum) print(example)
Получить комиссию для платежа
commission = wallet.commission(pid=99, recipient='79001234567', amount=1.11) print(commission.qw_commission.amount)
Для более подробных инструкций, посетите документацию.
aioqiwi 1.1.5
Handler manager QiwiClient.handler_manager or qiwi_client.hm is responsible for event-handlers registering and filtering/delivering updates to them. There’re currently two event processing strategies: 1. core.handler.EventProcessStrategy.ORDERED — sequential filter-check. has O(n) amplitude 2. core.handler.EventProcessStrategy.MILKSHAKE — as receives update, will shuffle existing handlers list. has O(n) amplitude
Filters results are not currently cached.
Some users don’t want mess with web-hooks, for those fellas aioqiwi has history_polling [wip] in aioqiwi.contrib . Different approach for dealing with payment events. Find usage example in examples/ directory.
🔥 Qiwi API p2p transactions(bills)
sent_invoice.pay_url will redirect us to something like:
💳 Handling bill payments
🗺 QIWI terminals
aioqiwi covers qiwi’s MAPS api in aioqiwi.terminals module
Connectors
QiwiClient.connector is responsible for making http requests. Current available request managers are located in aioqiwi.core.connectors
Default connector is aioqiwi.core.connectors.asyncio , but if it’s no suit for you, you can easily switch to another
Hacking connector
You can easily implement your own http client(connector), subclassing from aioqiwi.core.connectors.abstract.AbstractConnector . Take a look at “out of the box” aiohttp or asyncio sessions for the start.
👾 Handling errors
API request error
Consider we have a aioqiwi.wallet.Wallet instance with a named reference wallet to it. Known error when we cannot ask server for more than 50 rows in wallet.history . To handle that error, we simply:
TimeoutError
This is slight different error and aioqiwi should not be really responsible for it. It’s usually server-side error which makes exception that should be raised connector-specific. asyncio.TimeoutError is exception that is produced by asyncio connector. In aiohttp or other connectors it may differ.
⛏ return policies (types)
aioqiwi’s server.BaseWebHookView and requests.Requests support “return policy”, it means you can get response/update in the form that suits your needs. There’re currently 5 return policies.
- NOTHING — returns nothing(note: None is python’s implicit return), :note: returning nothing does not mean doing nothing, validation is done anyway
- READ_DATA — raw return once stream is read
- JSON — raw return once read data was deserialized
- MODEL — complex return once json deserialized and new model instantiated
- LIST_OF_MODELS — complex return once json deserialized as an iterable list with new instantiated models of json objects
❓ HOW-TOs
You can find examples in examples/ directory in github repository. For start examples above should be enough.
🔧 TODOs
Work in progress
🐦 Community
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
License
adilkhash/qiwi
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Python client for Qiwi Payments API (Qiwi Kassa, Qiwi Wallet)
from decimal import Decimal from qiwi_payments.kassa import QiwiKassa kassa = QiwiKassa('MY_SECRET_QIWI_KEY') invoice = kassa.create_bill( amount=Decimal('10.00'), currency='RUB', comment='Pay me ASAP' ) print(invoice.pay_url)
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Convenient lib qiwi.com api-wrapper
License
aqur1n/aioqiwi
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
readme.rst
Qiwi payments for humans(for healthy humans)
pip install -U git+https://github.com/aqur1n/aioqiwi
However aioqiwi is highly customizable. Example of switching json modules:
from aioqiwi import Wallet from aioqiwi.core.tooling import json wallet = Wallet() wallet.tools.json_module = json.JSONModule("orjson")
import asyncio from aioqiwi import Wallet async def qiwi(): async with Wallet("TOKEN from https://qiwi.com/api") as w: w.phone_number = '+7878787878' # phone number is not required by default, but some methods need it balance = await w.balance() print("ACCOUNTS:") for acc in balance.accounts: print(acc.alias, acc.balance) asyncio.run(qiwi())
aioqiwi provides user-friendly web-hooks handler
import asyncio from aioqiwi.wallet import WebHook, Wallet wallet = Wallet(". ") @wallet.hm(lambda event: . ) async def payments_handler(hook: WebHook): print(f"hook.payment.account> sent you event.payment>") @wallet.hm() async def secret_payments_handler(event: WebHook): await something(event.payment.commission.amount) wallet.idle(port=8090)
When you do Wallet::idle, aioqiwi adds connector closing to aiohttp.web.Application::on_shutdown to make sure connector closes, however if you want to avoid this behaviour pass close_connector_ate=False to Wallet::idle
Handler manager QiwiClient.handler_manager or qiwi_client.hm is responsible for event-handlers registering and filtering/delivering updates to them. There’re currently two event processing strategies: 1. core.handler.EventProcessStrategy.ORDERED — sequential filter-check. has O(n) amplitude 2. core.handler.EventProcessStrategy.MILKSHAKE — as receives update, will shuffle existing handlers list. has O(n) amplitude
Filters results are not currently cached.
Some users don’t want mess with web-hooks, for those fellas aioqiwi has history_polling [wip] in aioqiwi.contrib. Different approach for dealing with payment events. Find usage example in examples/ directory.
🔥 Qiwi API p2p transactions(bills)
import asyncio from aioqiwi import QiwiKassa from aioqiwi.core import returns async def test_kassa(): async with QiwiKassa("SECRET KEY from p2p.qiwi.com or kassa.qiwi.com") as kassa: kassa.tools.return_type = returns.ReturnType.JSON bill = await kassa.new_bill(price, lifetime = 1) # setting lifetime to 44 ahead today [default is 10] 45 - is max print("Url to pay:", bill['payUrl']) await kassa.close() asyncio.run(test_kassa())
sent_invoice.pay_url will redirect us to something like:
from aioqiwi.kassa import QiwiKassa, Notification kassa = QiwiKassa('PRIVATE_KEY') @kassa.hm(lambda bill: bill.bill.amount.currency == 'RUB') async def my_shiny_rubles_handler(bill_update: Notification): # do something pass kassa.idle()
aioqiwi covers qiwi’s MAPS api in aioqiwi.terminals module
QiwiClient.connector is responsible for making http requests. Current available request managers are located in aioqiwi.core.connectors
Default connector is aioqiwi.core.connectors.asyncio, but if it’s no suit for you, you can easily switch to another
from aioqiwi import Wallet from aioqiwi.core.connectors.aiohttp import AiohttpConnector wallet = Wallet("auth") # switch with read-to-use connector-like instance implementing wallet.connector = AiohttpConnector(timeout, "user-agent": "opeka/02">) # or switch with aioqiwi.core.connectors.abstract.Connector compatible class wallet.connector = AiohttpConnector
You can easily implement your own http client(connector), subclassing from aioqiwi.core.connectors.abstract.AbstractConnector. Take a look at «out of the box» aiohttp or asyncio sessions for the start.
Consider we have a aioqiwi.wallet.Wallet instance with a named reference wallet to it. Known error when we cannot ask server for more than 50 rows in wallet.history. To handle that error, we simply:
from aioqiwi.exceptions import AioqiwiError from aioqiwi.errors import ErrorInfo try: await wallet.history(2 ** 6) # pass rows=64, whilst constraint is 0 except AioqiwiError as exc: if exc.err: # this feature is experimental exc.err: ErrorInfo = exc.err # cast to aioqiwi.Wallet's error info print(exc.err.error_message)
This is slight different error and aioqiwi should not be really responsible for it. It’s usually server-side error which makes exception that should be raised connector-specific. asyncio.TimeoutError is exception that is produced by asyncio connector. In aiohttp or other connectors it may differ.
aioqiwi’s server.BaseWebHookView and requests.Requests support «return policy», it means you can get response/update in the form that suits your needs. There’re currently 5 return policies.
- NOTHING — returns nothing(note: None is python’s implicit return), :note: returning nothing does not mean doing nothing, validation is done anyway
- READ_DATA — raw return once stream is read
- JSON — raw return once read data was deserialized
- MODEL — complex return once json deserialized and new model instantiated
- LIST_OF_MODELS — complex return once json deserialized as an iterable list with new instantiated models of json objects
You can find examples in examples/ directory in github repository. For start examples above should be enough.
Uwinx group ✈️ Telegram
Aqur1n group 🎮 Discord
About
Convenient lib qiwi.com api-wrapper