上传网络背景报错信息
2026-04-15 19:03:34,696 - theme_manager - INFO - 开始下载网络图片: [img]https://static-event.benghuai.com/new_mihoyo_homepage/images/download/cg/origin/2024-01-29.jpg[/img]
INFO: ::ffff:192.168.16.1:3603 - "POST /api/theme/background/download HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "theme_manager.py", line 484, in download_background_from_url
NameError: name 'httpx' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "fastapi/applications.py", line 1133, in call
await super().call(scope, receive, send)
File "starlette/applications.py", line 113, in call
await self.middleware_stack(scope, receive, send)
File "starlette/middleware/errors.py", line 186, in call
raise exc
File "starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "starlette/middleware/exceptions.py", line 63, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "fastapi/middleware/asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
File "starlette/routing.py", line 716, in call
await self.middleware_stack(scope, receive, send)
File "starlette/routing.py", line 736, in app
await route.handle(scope, receive, send)
File "starlette/routing.py", line 290, in handle
await self.app(scope, receive, send)
File "fastapi/routing.py", line 123, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "fastapi/routing.py", line 109, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "fastapi/routing.py", line 389, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "fastapi/routing.py", line 288, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "theme_manager.py", line 577, in download_background_from_url
NameError: name 'httpx' is not defined