- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 143 for function (3.52 sec)
-
tests/test_generate_unique_id_function.py
app = FastAPI(generate_unique_id_function=custom_generate_unique_id) router = APIRouter(generate_unique_id_function=custom_generate_unique_id2) @app.post( "/", response_model=List[Item], responses={404: {"model": List[Message]}}, generate_unique_id_function=custom_generate_unique_id3, ) def post_root(item1: Item, item2: Item):
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Jan 13 15:10:26 GMT 2024 - 66.7K bytes - Viewed (0) -
docs/en/docs/tutorial/response-model.md
# Response Model - Return Type You can declare the type used for the response by annotating the *path operation function* **return type**. You can use **type annotations** the same way you would for input data in function **parameters**, you can use Pydantic models, lists, dictionaries, scalar values like integers, booleans, etc. === "Python 3.10+" ```Python hl_lines="16 21" {!> ../../../docs_src/response_model/tutorial001_01_py310.py!} ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 17.9K bytes - Viewed (0) -
docs/en/docs/tutorial/middleware.md
## Create a middleware To create a middleware you use the decorator `@app.middleware("http")` on top of a function. The middleware function receives: * The `request`. * A function `call_next` that will receive the `request` as a parameter. * This function will pass the `request` to the corresponding *path operation*. * Then it returns the `response` generated by the corresponding *path operation*.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Jan 11 16:31:18 GMT 2024 - 2.9K bytes - Viewed (0) -
docs/en/docs/tutorial/first-steps.md
### Step 4: define the **path operation function** This is our "**path operation function**": * **path**: is `/`. * **operation**: is `get`. * **function**: is the function below the "decorator" (below `@app.get("/")`). ```Python hl_lines="7" {!../../../docs_src/first_steps/tutorial001.py!} ``` This is a Python function.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu May 02 22:37:31 GMT 2024 - 12K bytes - Viewed (0) -
docs/en/docs/reference/background.md
# Background Tasks - `BackgroundTasks` You can declare a parameter in a *path operation function* or dependency function with the type `BackgroundTasks`, and then you can use it to schedule the execution of background tasks after the response is sent. You can import it directly from `fastapi`: ```python from fastapi import BackgroundTasks ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 377 bytes - Viewed (0) -
docs/en/docs/advanced/generate-clients.md
### Custom Generate Unique ID Function FastAPI uses a **unique ID** for each *path operation*, it is used for the **operation ID** and also for the names of any needed custom models, for requests or responses. You can customize that function. It takes an `APIRoute` and outputs a string.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 10.5K bytes - Viewed (0) -
docs/en/docs/tutorial/security/get-current-user.md
# Get Current User In the previous chapter the security system (which is based on the dependency injection system) was giving the *path operation function* a `token` as a `str`: === "Python 3.9+" ```Python hl_lines="12" {!> ../../../docs_src/security/tutorial001_an_py39.py!} ``` === "Python 3.8+" ```Python hl_lines="11" {!> ../../../docs_src/security/tutorial001_an.py!} ``` === "Python 3.8+ non-Annotated"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Jan 11 16:31:18 GMT 2024 - 7.6K bytes - Viewed (0) -
docs/en/docs/tutorial/path-params.md
So, if you run this example and go to <a href="http://127.0.0.1:8000/items/foo" class="external-link" target="_blank">http://127.0.0.1:8000/items/foo</a>, you will see a response of: ```JSON {"item_id":"foo"} ``` ## Path parameters with types You can declare the type of a path parameter in the function, using standard Python type annotations:
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.1K bytes - Viewed (0) -
docs/en/docs/advanced/dataclasses.md
8. Notice that this *path operation function* uses regular `def` instead of `async def`. As always, in FastAPI you can combine `def` and `async def` as needed. If you need a refresher about when to use which, check out the section _"In a hurry?"_ in the docs about [`async` and `await`](../async.md#in-a-hurry){.internal-link target=_blank}.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 4.1K bytes - Viewed (0) -
docs/en/docs/reference/request.md
# `Request` class You can declare a parameter in a *path operation function* or dependency to be of type `Request` and then you can access the raw request object directly, without any validation, etc. You can import it directly from `fastapi`: ```python from fastapi import Request ``` !!! tip
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 516 bytes - Viewed (0)