Skip to content

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

@tednved

Description

@tednved

运行最新版时当收到任意占卜指令时,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后参照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)
^^^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions