-
First Check
Commit to Help
Example Codefrom functools import partial
from fastapi import FastAPI, Depends
app = FastAPI()
def the_answer():
return 42
async def dep1(
n: int = Depends(the_answer),
):
return n + 1
@app.get("/")
def main(
d1=Depends(partial(dep1, n=10)),
):
print(d1) # prints "<coroutine object dep1 at 0x7facc996fb50>"
return {}
if __name__ == '__main__':
import uvicorn
uvicorn.run(app, port=1122) DescriptionI would've expected
Operating SystemLinux Operating System DetailsNo response FastAPI Version0.98.0 Python VersionPython 3.10.6 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Yeah. I think FastAPI would need to unwrap the |
Beta Was this translation helpful? Give feedback.
-
I've created this: #10720 |
Beta Was this translation helpful? Give feedback.
I've created this: #10720