noneplugin / nonebot-plugin-shindan

Nonebot2 趣味占卜插件
MIT License
48 stars 10 forks source link

0.6.1再次出现AssertionError,bot返回出错 #39

Open tednved opened 3 months ago

tednved commented 3 months ago

运行最新版时当收到任意占卜指令时,bot直接返回:出错了,请稍后再试,出现报错 07-28 13:14:34 [WARNING] nonebot_plugin_shindan | Traceback (most recent call last): File "E:\setuna-bot.venv\Lib\site-packages\nonebot_plugin_shindan__init__.py", line 171, in handler res = await make_shindan(shindan.id, name, shindan.mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\setuna-bot.venv\Lib\site-packages\nonebot_plugin_shindan\shindanmaker.py", line 82, in make_shindan html, has_chart = await render_html(content) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\setuna-bot.venv\Lib\site-packages\nonebot_plugin_shindan\shindanmaker.py", line 112, in render_html assert isinstance(result, Tag) ^^^^^^^^^^^^^^^^^^^^^^^ AssertionError

查阅issue#19后参照https://github.com/noneplugin/nonebot-plugin-shindan/commit/db6a6af7cd8a59b701e23f6a439a62dd5ce29d5b修改了 async def get(client: httpx.AsyncClient, url: str, kwargs): return await request(client, "GET", url, kwargs) 函数 为 async def post(client: httpx.AsyncClient, url: str, kwargs): resp = await client.post( url, headers=headers, timeout=20, follow_redirects=True, kwargs ) resp.raise_for_status() return resp 后其中一个报错消失,剩下报错

File "E:\setuna-bot.venv\Lib\site-packages\nonebot_plugin_shindan__init__.py", line 171, in handler res = await make_shindan(shindan.id, name, shindan.mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\setuna-bot.venv\Lib\site-packages\nonebot_plugin_shindan\shindanmaker.py", line 112, in render_html assert isinstance(result, Tag) ^^^^^^^^^^^^^^^^^^^^^^^

MeetWq commented 3 months ago

我这边没出问题,应该是网络问题,可以更新一下cookie或者挂代理试试