-
Notifications
You must be signed in to change notification settings - Fork 2
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
导入课表时报错httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol. #1
Comments
请问userdata.json文件里有用户发送的导出的链接吗?格式例如https://cdn.cnbj1.fds.api.mi-img.com/miai-fe-aischedule-wx-redirect-fe/redirect.html?linkToken= |
是空的 |
原因应该是获取用户发送的url后,没有监听到response.url,可能是我的正则匹配式
没过滤得到正确的response.url(莫非是小米id里面出现了字母?),你可以打开那个链接后打开开发者工具,然后找到network(网络)选项,刷新页面后可以看到一些请求的url,里面应该有一个类似https://i.ai.mi.com/course-multi/table?ctId=一些数字&userId=小米ID&deviceId=设备ID&sourceName=course-app-browser的请求url 你可以看看里面到底是啥 |
谢谢,导入的问题解决了,我看了下我的userId这一项是0匹配只有1-9所以匹配不上。不过现在有个新问题就是我获取整个周的课表信息是正确的但是当获取当天课表也就是文字信息的时候,信息是错误的。我怀疑和userId为0有关,但是没有找到解决方案。 |
那个小米ID为0的url是无效的,课表信息也是无效的(应该是官方测试用的),所以要过滤掉,你可以看到我这张截图里面有两项也是userId=0,按理来说应该是userId=123456 这种才是有效的。我现在推测的是可能有某一项没匹配上,例如本该是数字的部分有字母 |
我明白了,如果没有登录就制作课表并导入的话两个id就都会是0,登录以后刷新下链接就可以了再重新导入就可以了,现在可以正常使用了,十分感谢你的帮助 |
描述问题:
导入课表时无法正常导入报错 httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.
期望的结果
课表成功导入
环境信息:
OS: Ubuntu 22.04.1 LTS
Python Version: 3.10.6
Nonebot Version: v2.0.0rc3
httpx Version: 0.23.3
已安装 nonebot_plugin_htmlrender和nonebot_plugin_apscheduler
日志
[ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_ai_timetable) failed.
Traceback (most recent call last):
File "/root/nb/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/root/nb/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/root/nb/.venv/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 208, in handle_async_request
raise UnsupportedProtocol(
httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "", line 17, in
File "/root/nb/.venv/lib/python3.10/site-packages/nonebot/init.py", line 273, in run
get_driver().run(*args, **kwargs)
File "/root/nb/.venv/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 187, in run
uvicorn.run(
File "/root/nb/.venv/lib/python3.10/site-packages/uvicorn/main.py", line 568, in run
server.run()
File "/root/nb/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 59, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/root/nb/.venv/lib/python3.10/site-packages/nonebot/message.py", line 141, in _check_matcher
await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
The text was updated successfully, but these errors were encountered: