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

开启HTTP服务时报错 #115

Open
AlexYe233 opened this issue Apr 5, 2023 · 1 comment
Open

开启HTTP服务时报错 #115

AlexYe233 opened this issue Apr 5, 2023 · 1 comment

Comments

@AlexYe233
Copy link

复现问题:
按照下面的步骤可以复现问题:
LOG_LEVEL=DEBUG BaiduPCS-Py server --path '/my/pan'
问题出现

问题截图:
root@4G-wifi:~# BaiduPCS-Py server --path '/my/pan'
Server running on http://localhost:8000/my/pan/
(v0.7.6) System ERROR: Cannot specify Depends for type <class 'starlette.responses.Response'>

运行环境:
OS:Debian GNU/Linux 11 (bullseye)
Python 3.9.2
BaiduPCS App v0.7.6

运行日志:
2023-04-05 18:31:28,021 | DEBUG | app: app: System Error: Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/baidupcs_py/app/app.py", line 118, in wrap
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/baidupcs_py/app/app.py", line 177, in wrap
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/baidupcs_py/app/app.py", line 1766, in server
start_server(
File "/usr/local/lib/python3.9/dist-packages/baidupcs_py/commands/server.py", line 203, in start_server
make_http_server(path)
File "/usr/local/lib/python3.9/dist-packages/baidupcs_py/commands/server.py", line 157, in make_http_server
async def http_server(response: Response = Depends(handle_request)):
File "/usr/local/lib/python3.9/dist-packages/fastapi/routing.py", line 661, in decorator
self.add_api_route(
File "/usr/local/lib/python3.9/dist-packages/fastapi/routing.py", line 600, in add_api_route
route = route_class(
File "/usr/local/lib/python3.9/dist-packages/fastapi/routing.py", line 446, in init
self.dependant = get_dependant(path=self.path_format, call=self.endpoint)
File "/usr/local/lib/python3.9/dist-packages/fastapi/dependencies/utils.py", line 303, in get_dependant
type_annotation, depends, param_field = analyze_param(
File "/usr/local/lib/python3.9/dist-packages/fastapi/dependencies/utils.py", line 425, in analyze_param
assert depends is None, f"Cannot specify Depends for type {type_annotation!r}"
AssertionError: Cannot specify Depends for type <class 'starlette.responses.Response'>

2023-04-05 18:31:38,379 | DEBUG | app: app: _teardown: start
2023-04-05 18:31:38,380 | DEBUG | app: app: _teardown: end

Additional context / 补充内容

@VJ852
Copy link

VJ852 commented Oct 22, 2023

您可以使用以下命令尝试降级FastAPI和Starlette的版本:

pip install fastapi==0.68.0 starlette==0.14.2

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