コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 10 of about 12 for provided (0.003 sec.)
WebSockets 13088
WebSockets When defining WebSockets, you normally declare a parameter of type WebSocket and with it you can read data from the client and send data to it. It is provided directly by Starlette, but you can import it from fastapi : from fasta ... cketDisconnect ::: fastapi.WebSocketDisconnect WebSockets - additional classes Additional classes for handling WebSockets. Provided directly by Starlette, but you can import it from fastapi : from fastapi.websockets import WebSocketDisconnect , WebSocket ...
https://man.mtool.work/fastapi/0.115/reference/websockets/
Behind a Proxy 10966
Behind a Proxy Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In some situations, you might need to use a proxy server like Traefik or Nginx with a configuration ... seen by your application. In these cases you can use root_path to configure your application. The root_path is a mechanism provided by the ASGI specification (that FastAPI is built on, through Starlette). The root_path is used to handle these specific ca ... t the same response: { "message" : "Hello World" , "root_path" : "/api/v1" } but this time at the URL with the prefix path provided by the proxy: /api/v1 . Of course, the idea here is that everyone would access the app through the proxy, so the version w ... ith the path prefix /api/v1 is the "correct" one. And the version without the path prefix ( http://127.0.0.1:8000/app ), provided by Uvicorn directly, would be exclusively for the proxy (Traefik) to access it. That demonstrates how the Proxy (Traefik) ...
https://man.mtool.work/fastapi/0.115/advanced/behind-a-proxy/
Middleware 10170
Middleware There are several middlewares available provided by Starlette directly. Read more about them in the FastAPI docs for Middleware . ::: fastapi.middleware.cors.CORSMiddleware It can be imported from fastapi : from fastapi.middlewar ...
https://man.mtool.work/fastapi/0.115/reference/middleware/
Status Codes 9905
Status Codes You can import the status module from fastapi : from fastapi import status status is provided directly by Starlette. It contains a group of named constants (variables) with integer status codes. For example: 200: status.HTTP_20 ...
https://man.mtool.work/fastapi/0.115/reference/status/
Bigger Applications - Multiple Files 8843
Bigger Applications - Multiple Files Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . If you are building an application or a web API, it's rarely the case that you ... _query_token ( token : str ): if token != "jessica" : raise HTTPException ( status_code = 400 , detail = "No Jessica token provided" ) app/dependencies.py from fastapi import Header , HTTPException from typing_extensions import Annotated async def get_to ... _query_token ( token : str ): if token != "jessica" : raise HTTPException ( status_code = 400 , detail = "No Jessica token provided" ) Tip Prefer to use the Annotated version if possible. app/dependencies.py from fastapi import Header , HTTPException asy ... _query_token ( token : str ): if token != "jessica" : raise HTTPException ( status_code = 400 , detail = "No Jessica token provided" ) Tip We are using an invented header to simplify this example. But in real cases you will get better results using the i ...
https://man.mtool.work/fastapi/0.115/tutorial/bigger-applications/
Templates 8295
Templates Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can use any template engine you want with FastAPI . A common choice is Jinja2, the same one used by F ... lask and other tools. There are utilities to configure it easily that you can use directly in your FastAPI application (provided by Starlette). Install dependencies Make sure you create a virtual environment , activate it, and install jinja2 : $ pip i ...
https://man.mtool.work/fastapi/0.115/advanced/templates/
Async Tests 8030
Async Tests Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You have already seen how to test your FastAPI applications using the provided TestClient . Up to now, ...
https://man.mtool.work/fastapi/0.115/advanced/async-tests/
Custom Request and APIRoute class 7499
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 ... custom GzipRequest class Tip This is a toy example to demonstrate how it works, if you need Gzip support, you can use the provided GzipMiddleware . First, we create a GzipRequest class, which will overwrite the Request.body() method to decompress the bo ...
https://man.mtool.work/fastapi/0.115/how-to/custom-request-and-route/
Simple OAuth2 with Password and Bearer 7499
Simple OAuth2 with Password and Bearer Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Now let's build from the previous chapter and add the missing parts to have ... plementation specific. For OAuth2 they are just strings. Code to get the username and password Now let's use the utilities provided by FastAPI to handle this. OAuth2PasswordRequestForm First, import OAuth2PasswordRequestForm , and use it as a dependency ... you could have written yourself, or you could have declared Form parameters directly. But as it's a common use case, it is provided by FastAPI directly, just to make it easier. Use the form data Tip The instance of the dependency class OAuth2PasswordRequ ... se), the value of that header should be Bearer . You can actually skip that extra header and it would still work. But it's provided here to be compliant with the specifications. Also, there might be tools that expect and use it (now or in the future) and ...
https://man.mtool.work/fastapi/0.115/tutorial/security/simple-oauth2/
Generate Clients 7234
Generate Clients Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . As FastAPI is based on the OpenAPI specification, you get automatic compatibility with many tools, ... including the automatic API docs (provided by Swagger UI). One particular advantage that is not necessarily obvious is that you can generate clients (sometimes calle ...
https://man.mtool.work/fastapi/0.115/advanced/generate-clients/
PREV 1 2 NEXT