Results of 1 - 4 of about 4 for callable (0.001 sec.)
- Custom Request and APIRoute class 12426
- Custom Request and APIRoute class Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In some cases, you may want to override the logic used by the Request and APIRout
...way, the same route class can handle gzip compressed or uncompressed requests. Python 3.8+ import gzip from typing import Callable , List from fastapi import Body , FastAPI , Request , Response from fastapi.routing import APIRoute class GzipRequest ( Re...ecompress ( body ) self . _body = body return self . _body class GzipRoute ( APIRoute ): def get_route_handler ( self ) -> Callable : original_route_handler = super () . get_route_handler () async def custom_route_handler ( request : Request ) -> Respons...n a response. Here we use it to create a GzipRequest from the original request. Python 3.8+ import gzip from typing import Callable , List from fastapi import Body , FastAPI , Request , Response from fastapi.routing import APIRoute class GzipRequest ( Re... - https://man.mtool.work/fastapi/0.115/how-to/custom-request-and-route/
- Advanced Dependencies 8247
- Advanced Dependencies Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Parameterized dependencies All the dependencies we have seen are a fixed function or class. B
...checks if the query parameter q contains some fixed content. But we want to be able to parameterize that fixed content. A "callable" instance In Python there's a way to make an instance of a class a "callable". Not the class itself (which is already a ca... - https://man.mtool.work/fastapi/0.115/advanced/advanced-dependencies/
- Dependencies - Depends() and Security() 8247
- Dependencies - Depends() and Security() Depends() Dependencies are handled mainly with the special function Depends() that takes a callable. Here is the reference for it and its parameters. You can import it directly from fastapi : from fas
... - https://man.mtool.work/fastapi/0.115/reference/dependencies/
- Security Tools 8007
- Security Tools When you need to declare dependencies with OAuth2 scopes you use Security() . But you still need to define what is the dependable, the callable that you pass as a parameter to Depends() or Security() . There are multiple tool
... - https://man.mtool.work/fastapi/0.115/reference/security/
PREV
1
NEXT