A
A
Alex_8882020-06-10 15:16:51
Python
Alex_888, 2020-06-10 15:16:51

AsyncioConnector._request was never expected. How to make her wait?

Git hub code from the library developer

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())


I get an error
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
[email protected]-1vcpu-1gb-nyc1-01:/usr/local/bin/bot#

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Baron Grafovich, 2021-02-16
@FlooJack

Hey! did you manage to make a request? I myself am now trying the same thing, it gives out AsyncioConnector._request

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question