Wei*_*914 3 python asynchronous async-await python-asyncio aiohttp
我正在尝试从我使用包装器的 api 获得一些响应。
我寻找了更多错误,但他们没有解决我的问题。我不太了解 await 函数或协程。我关闭了 is_asnyc,它起作用了,但我需要那个选项。所以我不能关闭它。
import clashroyale, asyncio
token = "my token"
cr = clashroyale.official_api.Client(token=token, is_async=True)
async def top():
p = await cr.get_top_players()
return p
topplayers = asyncio.run(top())
Run Code Online (Sandbox Code Playgroud)
我排除了它只是从api获取信息但出现错误-
RuntimeError: Timeout context manager should be used inside a task
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001774361A3C8>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2593 次 |
最近记录: |