Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tednved opened this issue Jul 28, 2024 · 1 comment
Open

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

tednved opened this issue Jul 28, 2024 · 1 comment

Comments

@tednved
Copy link

tednved commented Jul 28, 2024

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

@MeetWq
Copy link
Member

MeetWq commented Jul 28, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants