Код с гит хаба от разработчика библиотеки
import asyncio
from aioqiwi import QiwiKassa
async def test_kassa():
async with QiwiKassa("***********") as kassa:
sent_invoice = await kassa.new_bill(14.88, lifetime=44)
# setting lifetime to 44 ahead today [default is 10] 45 - is max
print("Url to pay:", sent_invoice.pay_url)
await kassa.close()
asyncio.run(test_kassa())
Получаю ошибку
Traceback (most recent call last):
File "qiwi.py", line 13, in <module>
asyncio.run(test_kassa())
File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
return future.result()
File "qiwi.py", line 8, in test_kassa
sent_invoice = await kassa.new_bill(14.88, lifetime=44)
File "/usr/local/lib/python3.7/dist-packages/aioqiwi/kassa/requests.py", line 119, in new_bill
response = await self.connector.request("PUT", url, data=data)
File "/usr/local/lib/python3.7/dist-packages/aioqiwi/core/connectors/asyncio.py", line 194, in request
loop=self.loop,
File "/usr/lib/python3.7/asyncio/tasks.py", line 435, in wait_for
await waiter
RuntimeError: Task <Task pending coro=<test_kassa() running at qiwi.py:8> cb=[_run_until_complete_cb() at /usr/lib/python3.7/asyncio/base_events.py:157]> got Future <Future pending> attached to a different loop
Task was destroyed but it is pending!
task: <Task pending coro=<AsyncioConnector._request() running at /usr/local/lib/python3.7/dist-packages/aioqiwi/core/connectors/asyncio.py:151> cb=[_release_waiter(<Future pending>)() at /usr/lib/python3.7/asyncio/tasks.py:392]>
sys:1: RuntimeWarning: coroutine 'AsyncioConnector._request' was never awaited
root@ubuntu-s-1vcpu-1gb-nyc1-01:/usr/local/bin/bot#