Files
cms-website/.deps_siteforge_v812/fastapi/__pycache__/applications.cpython-312.pyc
T

2015 lines
85 KiB
Plaintext
Raw Normal View History

Ë
ñÅÙjÂãóÆ—ddlmZmZmZddlmZddlmZmZm Z m
Z
m Z m Z ddl
mZddlmZddlmZmZddlmZmZmZddlmZmZdd lmZdd
lmZdd lm Z m!Z!m"Z"dd l#m$Z$dd
l%m&Z&ddl'm(Z(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;ddl<m=Z=m>Z>m?Z?ddl@mAZAddlBmCZCmDZDmEZEmFZFmGZGmHZHddlImJZJe dd¬«ZKGd„de-«ZLy )!é)Ú AwaitableÚ CoroutineÚSequence)ÚEnum)Ú AnnotatedÚAnyÚCallableÚOptionalÚTypeVarÚUnion)ÚDoc)Úrouting)ÚDefaultÚDefaultPlaceholder)Úhttp_exception_handlerÚ$request_validation_exception_handlerÚ.websocket_request_validation_exception_handler)ÚRequestValidationErrorÚWebSocketRequestValidationError)Úlogger)ÚAsyncExitStackMiddleware)Úget_redoc_htmlÚget_swagger_ui_htmlÚ#get_swagger_ui_oauth2_redirect_html)Ú get_openapi)ÚDepends)ÚDecoratedCallableÚIncEx)Úgenerate_unique_id)Ú Starlette)ÚState)Ú
HTTPException)Ú
Middleware)ÚBaseHTTPMiddleware)ÚServerErrorMiddleware)ÚExceptionMiddleware)ÚRequest)Ú HTMLResponseÚ JSONResponseÚResponse)Ú BaseRoute)ÚASGIAppÚExceptionHandlerÚLifespanÚReceiveÚScopeÚSend)Ú
deprecatedÚAppTypeÚFastAPI)ÚboundcQóÔ(‡—eZdZdZddddddddddee«ddd d
ddddddddddddddddddee«ddd œ$d ed
ee e
d«fdee e e
e
d«ed«fdeee
d«fdee ee
d«fdeee
d«fdeee
d«fdee ee
d«fdee e eeefe
d«fdee e eeeeeffe
d«fd ee eee
d!«fd"eeee
d#«fd$ee e
d%«fd&ee ee
d'«fd(ee ee
d)«fd*ee ee
d+«fd,ee eeefe
d-«fd.ee eee
d/«fd0ee eeeeefeeegeeeefffe
d1«fd2ee eegefe
d3«fd4ee eegefe
d5«fd6ee eee
d7«fd8ee ee
d9«fd:ee eeeeeffe
d;«fd<ee eeeeeffe
d=«fd>eee
d?«ed@«fdAeee
dB«fdCee e
dD«fdEee eeeefeeeffe
dF«fdGee e e
e
dH«fdIee ej>e
dJ«fdKee e e
dL«fdMee e
dN«fdOee eeefe
dP«fdQeeej@gefe
dR«fdSee e
dT«fdUee eeefe
dV«fdWeee
dX«fdYdfNdZ„Z!dYe"fd[„Z#dYeeeffd\„Z$d³d]„Z%d^e&d_e'd`e(dYdfˆfda„ Z)ed«ddddddbdddddddddddee«ddee«dcœddedeedfefdgedhe edie e eee*fd e eede ede edjedEe eeeefeeeffdKe e dke e edle edme e+dne e+doe dpe dqe dre dMe dseeee,fdte edue eeefdQeej@gefdYdf2dv„Z-ed«ddddddbdddddddddddee«ddee«dcœddedgedhe edie e eee*fd e eede ede edjedEe eeeefeeeffdKe e dke e edle edme e+dne e+doe dpe dqe dre dMe dseedte edue eeefdQeej@gefdYee.ge.ff0dw„Z/ d´ddxœddedeedfefdte ed e eedYdf
dy„Z0 d´ddxœddeee
dz«fdtee ee
d{«fd ee eee
d|«fdYee.ge.ffd}„Z1ddddddee«dee«d~œ deej>e
d€«fd�eee
d‚«fdiee e eee*fe
dƒ«fd ee eee
d„«fdEee eeeefeeeffe
dF«fdKee e e
d…«fdMee e
d†«fd"eeee
d‡«fdGee e e
e
dˆ«fdQeeej@gefe
dR«fdYdfd‰„Z2ed«ddddddbddddddddddee«dddee«dŠœddeee
d‹«fdgeee
dŒ«fdhee ee
d�«fdiee e eee*fe
dޫfd ee eee
d�«fdee ee
d�«fdee ee
d‘«fdjeee
d’«fdEee eeeefeeeffe
d“«fdKee e e
d”«fdlee ee
d•«fdmee e+e
d–«fdnee e+e
d—«fdoee e
d˜«fdpee e
d™«fdqee e
dš«fdree e
d›«fdMee e
dœ«fdseeee
d�«fdtee ee
dž«fdGee e e
e
dˆ«fduee eeefe
dŸ«fdQeeej@gefe
dR«fdYee.ge.ff0d „Z3ed«ddddddbddddddddddee«dddee«dŠœddeee
d‹«fdgeee
dŒ«fdhee ee
d�«fdiee e eee*fe
dޫfd ee eee
d�«fdee ee
d�«fdee ee
d‘«fdjeee
d’«fdEee eeeefeeeffe
d“«fdKee e e
d”«fdlee ee
d•«fdmee e+e
d–«fdnee e+e
d—«fdoee e
d˜«fdpee e
d™«fdqee e
dš«fdree e
d›«fdMee e
dœ«fdseeee
d�«fdtee ee
dž«fdGee e e
e
dˆ«fduee eeefe
dŸ«fdQeeej@gefe
dR«fdYee.ge.ff0d¡„Z4ed«ddddddbddddddddddee«dddee«dŠœddeee
d‹«fdgeee
dŒ«fdhee ee
d�«fdiee e eee*fe
dޫfd ee eee
d�«fdee ee
d�«fdee ee
d‘«fdjeee
d’«fdEee eeeefeeeffe
d“«fdKee e e
d”«fdlee ee
d•«fdmee e+e
d–«fdnee e+e
d—«fdoee e
d˜«fdpee e
d™«fdqee e
dš«fdree e
d›«fdMee e
dœ«fdseeee
d�«fdtee ee
dž«fdGee e e
e
dˆ«fduee eeefe
dŸ«fdQeeej@gefe
dR«fdYee.ge.ff0d¢„Z5ed«ddddddbddddddddddee«dddee«dŠœddeee
d‹«fdgeee
dŒ«fdhee ee
d�«fdiee e eee*fe
dޫfd ee eee
d�«fdee ee
d�«fdee ee
d‘«fdjeee
d’«fdEee eeeefeeeffe
d“«fdKee e e
d”«fdlee ee
d•«fdmee e+e
d–«fdnee e+e
d—«fdoee e
d˜«fdpee e
d™«fdqee e
dš«fdree e
d›«fdMee e
dœ«fdseeee
d�«fdtee ee
dž«fdGee e e
e
dˆ«fduee eeefe
dŸ«fdQeeej@gefe
dR«fdYee.ge.ff0d£„Z6ed«ddddddbddddddddddee«dddee«dŠœddeee
d‹«fdgeee
dŒ«fdhee ee
d�«fdiee e eee*fe
dޫfd ee eee
d�«fdee ee
d�«fdee ee
d‘«fdjeee
d’«fdEee eeeefeeeffe
d“«fdKee e e
d”«fdlee ee
d•«fdmee e+e
d–«fdnee e+e
d—«fdoee e
d˜«fdpee e
d™«fdqee e
dš«fdree e
d›«fdMee e
dœ«fdseeee
d�«fdtee ee
dž«fdGee e e
e
dˆ«fduee eeefe
dŸ«fdQeeej@gefe
dR«fdYee.ge.ff0d¤„Z7ed«ddddddbddddddddddee«dddee«dŠœddeee
d‹«fdgeee
dŒ«fdhee ee
d�«fdiee e eee*fe
dޫfd ee eee
d�«fdee ee
d�«fdee ee
d‘«fdjeee
d’«fdEee eeeefeeeffe
d“«fdKee e e
d”«fdlee ee
d•«fdmee e+e
d–«fdnee e+e
d—«fdoee e
d˜«fdpee e
d™«fdqee e
dš«fdree e
d›«fdMee e
dœ«fdseeee
d�«fdtee ee
dž«fdGee e e
e
dˆ«fduee eeefe
dŸ«fdQeeej@gefe
dR«fdYee.ge.ff0d¥„Z8ed«ddddddbddddddddddee«dddee«dŠœddeee
d‹«fdgeee
dŒ«fdhee ee
d�«fdiee e eee*fe
dޫfd ee eee
d�«fdee ee
d�«fdee ee
d‘«fdjeee
d’«fdEee eeeefeeeffe
d“«fdKee e e
d”«fdlee ee
d•«fdmee e+e
d–«fdnee e+e
d—«fdoee e
d˜«fdpee e
d™«fdqee e
dš«fdree e
d›«fdMee e
dœ«fdseeee
d�«fdtee ee
dž«fdGee e e
e
dˆ«fduee eeefe
dŸ«fdQeeej@gefe
dR«fdYee.ge.ff0d¦„Z9ed«ddddddbddddddddddee«dddee«dŠœddeee
d‹«fdgeee
dŒ«fdhee ee
d�«fdiee e eee*fe
dޫfd ee eee
d�«fdee ee
d�«fdee ee
d‘«fdjeee
d’«fdEee eeeefeeeffe
d“«fdKee e e
d”«fdlee ee
d•«fdmee e+e
d–«fdnee e+e
d—«fdoee e
d˜«fdpee e
d™«fdqee e
dš«fdree e
d›«fdMee e
dœ«fdseeee
d�«fdtee ee
dž«fdGee e e
e
dˆ«fduee eeefe
dŸ«fdQeeej@gefe
dR«fdYee.ge.ff0d§„Z: d´ddedteedfdYee.ge.ffd¨„Z;ed©«dªeee
d««fdYee.ge.ffd¬„«Z<d­eee
d®«fdYee.ge.ffd¯„Z=d°eeeeefe
d±«fdYee.ge.ffd²„Z>ˆxZ?S)µr4a 
`FastAPI` app class, the main entrypoint to use FastAPI.
Read more in the
[FastAPI docs for First Steps](https://fastapi.tiangolo.com/tutorial/first-steps/).
## Example
```python
from fastapi import FastAPI
app = FastAPI()
```
FNÚz0.1.0z
/openapi.jsonTz/docsz/redocz/docs/oauth2-redirect)$ÚdebugÚroutesÚtitleÚsummaryÚ descriptionÚversionÚ openapi_urlÚ openapi_tagsÚserversÚ dependenciesÚdefault_response_classÚredirect_slashesÚdocs_urlÚ redoc_urlÚswagger_ui_oauth2_redirect_urlÚswagger_ui_init_oauthÚ
middlewareÚexception_handlersÚ
on_startupÚ on_shutdownÚlifespanÚterms_of_serviceÚcontactÚ license_infoÚopenapi_prefixÚ root_pathÚroot_path_in_serversÚ responsesÚ callbacksÚwebhooksr2Úinclude_in_schemaÚswagger_ui_parametersÚgenerate_unique_id_functionÚseparate_input_output_schemasÚopenapi_external_docsÚselfr8a
Boolean indicating if debug tracebacks should be returned on server
errors.
Read more in the
[Starlette docs for Applications](https://www.starlette.dev/applications/#instantiating-the-application).
r9a 
**Note**: you probably shouldn't use this parameter, it is inherited
from Starlette and supported for compatibility.
---
A list of routes to serve incoming HTTP and WebSocket requests.
a/
You normally wouldn't use this parameter with FastAPI, it is inherited
from Starlette and supported for compatibility.
In FastAPI, you normally would use the *path operation methods*,
like `app.get()`, `app.post()`, etc.
r:aÚ
The title of the API.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more in the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).
**Example**
```python
from fastapi import FastAPI
app = FastAPI(title="ChimichangApp")
```
r;aø
A short summary of the API.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more in the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).
**Example**
```python
from fastapi import FastAPI
app = FastAPI(summary="Deadpond's favorite app. Nuff said.")
```
r<u 
A description of the API. Supports Markdown (using
[CommonMark syntax](https://commonmark.org/)).
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more in the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).
**Example**
```python
from fastapi import FastAPI
app = FastAPI(
description="""
ChimichangApp API helps you do awesome stuff. 🚀
## Items
You can **read items**.
## Users
You will be able to:
* **Create users** (_not implemented_).
* **Read users** (_not implemented_).
"""
)
```
r=a}
The version of the API.
**Note** This is the version of your application, not the version of
the OpenAPI specification nor the version of FastAPI being used.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more in the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).
**Example**
```python
from fastapi import FastAPI
app = FastAPI(version="0.0.1")
```
r>aq
The URL where the OpenAPI schema will be served from.
If you set it to `None`, no OpenAPI schema will be served publicly, and
the default automatic endpoints `/docs` and `/redoc` will also be
disabled.
Read more in the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#openapi-url).
**Example**
```python
from fastapi import FastAPI
app = FastAPI(openapi_url="/api/v1/openapi.json")
```
r?ae
A list of tags used by OpenAPI, these are the same `tags` you can set
in the *path operations*, like:
* `@app.get("/users/", tags=["users"])`
* `@app.get("/items/", tags=["items"])`
The order of the tags can be used to specify the order shown in
tools like Swagger UI, used in the automatic path `/docs`.
It's not required to specify all the tags used.
The tags that are not declared MAY be organized randomly or based
on the tools' logic. Each tag name in the list MUST be unique.
The value of each item is a `dict` containing:
* `name`: The name of the tag.
* `description`: A short description of the tag.
[CommonMark syntax](https://commonmark.org/) MAY be used for rich
text representation.
* `externalDocs`: Additional external documentation for this tag. If
provided, it would contain a `dict` with:
* `description`: A short description of the target documentation.
[CommonMark syntax](https://commonmark.org/) MAY be used for
rich text representation.
* `url`: The URL for the target documentation. Value MUST be in
the form of a URL.
Read more in the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-tags).
**Example**
```python
from fastapi import FastAPI
tags_metadata = [
{
"name": "users",
"description": "Operations with users. The **login** logic is also here.",
},
{
"name": "items",
"description": "Manage items. So _fancy_ they have their own docs.",
"externalDocs": {
"description": "Items external docs",
"url": "https://fastapi.tiangolo.com/",
},
},
]
app = FastAPI(openapi_tags=tags_metadata)
```
r@aœ
A `list` of `dict`s with connectivity information to a target server.
You would use it, for example, if your application is served from
different domains and you want to use the same Swagger UI in the
browser to interact with each of them (instead of having multiple
browser tabs open). Or if you want to leave fixed the possible URLs.
If the servers `list` is not provided, or is an empty `list`, the
`servers` property in the generated OpenAPI will be:
* a `dict` with a `url` value of the application's mounting point
(`root_path`) if it's different from `/`.
* otherwise, the `servers` property will be omitted from the OpenAPI
schema.
Each item in the `list` is a `dict` containing:
* `url`: A URL to the target host. This URL supports Server Variables
and MAY be relative, to indicate that the host location is relative
to the location where the OpenAPI document is being served. Variable
substitutions will be made when a variable is named in `{`brackets`}`.
* `description`: An optional string describing the host designated by
the URL. [CommonMark syntax](https://commonmark.org/) MAY be used for
rich text representation.
* `variables`: A `dict` between a variable name and its value. The value
is used for substitution in the server's URL template.
Read more in the
[FastAPI docs for Behind a Proxy](https://fastapi.tiangolo.com/advanced/behind-a-proxy/#additional-servers).
**Example**
```python
from fastapi import FastAPI
app = FastAPI(
servers=[
{"url": "https://stag.example.com", "description": "Staging environment"},
{"url": "https://prod.example.com", "description": "Production environment"},
]
)
```
rAa`
A list of global dependencies, they will be applied to each
*path operation*, including in sub-routers.
Read more about it in the
[FastAPI docs for Global Dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/global-dependencies/).
**Example**
```python
from fastapi import Depends, FastAPI
from .dependencies import func_dep_1, func_dep_2
app = FastAPI(dependencies=[Depends(func_dep_1), Depends(func_dep_2)])
```
rBa
The default response class to be used.
Read more in the
[FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#default-response-class).
**Example**
```python
from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
app = FastAPI(default_response_class=ORJSONResponse)
```
rCa”
Whether to detect and redirect slashes in URLs when the client doesn't
use the same format.
**Example**
```python
from fastapi import FastAPI
app = FastAPI(redirect_slashes=True) # the default
@app.get("/items/")
async def read_items():
return [{"item_id": "Foo"}]
```
With this app, if a client goes to `/items` (without a trailing slash),
they will be automatically redirected with an HTTP status code of 307
to `/items/`.
rDa¢
The path to the automatic interactive API documentation.
It is handled in the browser by Swagger UI.
The default URL is `/docs`. You can disable it by setting it to `None`.
If `openapi_url` is set to `None`, this will be automatically disabled.
Read more in the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#docs-urls).
**Example**
```python
from fastapi import FastAPI
app = FastAPI(docs_url="/documentation", redoc_url=None)
```
rEa¢
The path to the alternative automatic interactive API documentation
provided by ReDoc.
The default URL is `/redoc`. You can disable it by setting it to `None`.
If `openapi_url` is set to `None`, this will be automatically disabled.
Read more in the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#docs-urls).
**Example**
```python
from fastapi import FastAPI
app = FastAPI(docs_url="/documentation", redoc_url="redocumentation")
```
rFa
The OAuth2 redirect endpoint for the Swagger UI.
By default it is `/docs/oauth2-redirect`.
This is only used if you use OAuth2 (with the "Authorize" button)
with Swagger UI.
rGa
OAuth2 configuration for the Swagger UI, by default shown at `/docs`.
Read more about the available configuration options in the
[Swagger UI docs](https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/).
rHaO
List of middleware to be added when creating the application.
In FastAPI you would normally do this with `app.add_middleware()`
instead.
Read more in the
[FastAPI docs for Middleware](https://fastapi.tiangolo.com/tutorial/middleware/).
rIaH
A dictionary with handlers for exceptions.
In FastAPI, you would normally use the decorator
`@app.exception_handler()`.
Read more in the
[FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).
rJzý
A list of startup event handler functions.
You should instead use the `lifespan` handlers.
Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).
rKa
A list of shutdown event handler functions.
You should instead use the `lifespan` handlers.
Read more in the
[FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).
rLa'
A `Lifespan` context manager handler. This replaces `startup` and
`shutdown` functions with a single context manager.
Read more in the
[FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).
rMaÚ
A URL to the Terms of Service for your API.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more at the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).
**Example**
```python
app = FastAPI(terms_of_service="http://example.com/terms/")
```
rNaY
A dictionary with the contact information for the exposed API.
It can contain several fields.
* `name`: (`str`) The name of the contact person/organization.
* `url`: (`str`) A URL pointing to the contact information. MUST be in
the format of a URL.
* `email`: (`str`) The email address of the contact person/organization.
MUST be in the format of an email address.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more at the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).
**Example**
```python
app = FastAPI(
contact={
"name": "Deadpoolio the Amazing",
"url": "http://x-force.example.com/contact/",
"email": "dp@x-force.example.com",
}
)
```
rOa¼
A dictionary with the license information for the exposed API.
It can contain several fields.
* `name`: (`str`) **REQUIRED** (if a `license_info` is set). The
license name used for the API.
* `identifier`: (`str`) An [SPDX](https://spdx.dev/) license expression
for the API. The `identifier` field is mutually exclusive of the `url`
field. Available since OpenAPI 3.1.0, FastAPI 0.99.0.
* `url`: (`str`) A URL to the license used for the API. This MUST be
the format of a URL.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more at the
[FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).
**Example**
```python
app = FastAPI(
license_info={
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html",
}
)
```
rPzC
A URL prefix for the OpenAPI URL.
zÍ
"openapi_prefix" has been deprecated in favor of "root_path", which
follows more closely the ASGI standard, is simpler, and more
automatic.
rQaþ
A path prefix handled by a proxy that is not seen by the application
but is seen by external clients, which affects things like Swagger UI.
Read more about it at the
[FastAPI docs for Behind a Proxy](https://fastapi.tiangolo.com/advanced/behind-a-proxy/).
**Example**
```python
from fastapi import FastAPI
app = FastAPI(root_path="/api/v1")
```
rRa
To disable automatically generating the URLs in the `servers` field
in the autogenerated OpenAPI using the `root_path`.
Read more about it in the
[FastAPI docs for Behind a Proxy](https://fastapi.tiangolo.com/advanced/behind-a-proxy/#disable-automatic-server-from-root-path).
**Example**
```python
from fastapi import FastAPI
app = FastAPI(root_path_in_servers=False)
```
rSa*
Additional responses to be shown in OpenAPI.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more about it in the
[FastAPI docs for Additional Responses in OpenAPI](https://fastapi.tiangolo.com/advanced/additional-responses/).
And in the
[FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies).
rTaP
OpenAPI callbacks that should apply to all *path operations*.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more about it in the
[FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/).
rUaÜ
Add OpenAPI webhooks. This is similar to `callbacks` but it doesn't
depend on specific *path operations*.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
**Note**: This is available since OpenAPI 3.1.0, FastAPI 0.99.0.
Read more about it in the
[FastAPI docs for OpenAPI Webhooks](https://fastapi.tiangolo.com/advanced/openapi-webhooks/).
r2a­
Mark all *path operations* as deprecated. You probably don't need it,
but it's available.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more about it in the
[FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#deprecate-a-path-operation).
rVaÔ
To include (or not) all the *path operations* in the generated OpenAPI.
You probably don't need it, but it's available.
This affects the generated OpenAPI (e.g. visible at `/docs`).
Read more about it in the
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
rWaF
Parameters to configure Swagger UI, the autogenerated interactive API
documentation (by default at `/docs`).
Read more about it in the
[FastAPI docs about how to Configure Swagger UI](https://fastapi.tiangolo.com/how-to/configure-swagger-ui/).
rXaÜ
Customize the function used to generate unique IDs for the *path
operations* shown in the generated OpenAPI.
This is particularly useful when automatically generating clients or
SDKs for your API.
Read more about it in the
[FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function).
rYaÂ
Whether to generate separate OpenAPI schemas for request body and
response body when the results would be more precise.
This is particularly useful when automatically generating clients.
For example, if you have a model like:
```python
from pydantic import BaseModel
class Item(BaseModel):
name: str
tags: list[str] = []
```
When `Item` is used for input, a request body, `tags` is not required,
the client doesn't have to provide it.
But when using `Item` for output, for a response body, `tags` is always
available because it has a default value, even if it's just an empty
list. So, the client should be able to always expect it.
In this case, there would be two different schemas, one for input and
another one for output.
Read more about it in the
[FastAPI docs about how to separate schemas for input and output](https://fastapi.tiangolo.com/how-to/separate-openapi-schemas)
rZaî
This field allows you to provide additional external documentation links.
If provided, it must be a dictionary containing:
* `description`: A brief description of the external documentation.
* `url`: The URL pointing to the external documentation. The value **MUST**
be a valid URL format.
**Example**:
```python
from fastapi import FastAPI
external_docs = {
"description": "Detailed API Reference",
"url": "https://example.com/api-docs",
}
app = FastAPI(openapi_external_docs=external_docs)
```
Úextraz€
Extra keyword arguments to be stored in the app, not used by FastAPI
anywhere.
Úreturnc$ óò—||_||_||_||_||_||_||_||_||_||_ ||_
|
|_ ||_ ||_
||_|!|_| xsg|_|#|_|$|_|%|_d|_d|_|jr&|jsJd«‚|jsJd«‚|rt-j.d«|xst1j2«|_|xs||_t9«|_i|_t1j2|| ||||| |
||| ||"¬«
|_|€in
tA|«|_!|jBjEtFtH«|jBjEtJtL«|jBjEtNtP«|€gn
tS|«|_*d|_+|jY«y)Nz3.1.0z4A title must be provided for OpenAPI, e.g.: 'My API'z5A version must be provided for OpenAPI, e.g.: '2.1.0'zÕ"openapi_prefix" has been deprecated in favor of "root_path", which follows more closely the ASGI standard, is simpler, and more automatic. Check the docs at https://fastapi.tiangolo.com/advanced/sub-applications/)
r9rCÚdependency_overrides_providerrJrKrLrBrArTr2rVrSrX)-r8r:r;r<r=rMrNrOr>r?rRrDrErFrGrWr@rYrZr\Úopenapi_versionÚopenapi_schemarÚwarningrÚ APIRouterrUrQr!ÚstateÚdependency_overridesÚrouterÚdictrIÚ
setdefaultr"rrrrrÚlistÚuser_middlewareÚmiddleware_stackÚsetup)&r[r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUr2rVrWrXrYrZr\s& úXC:\Users\30997\AppData\Local\Temp\pip-target-6g32zz5s\lib\python\fastapi/applications.pyÚ__init__zFastAPI.__init__@s
€ðrˆŒ
؈Œ
؈Œ Ø&ˆÔ؈Œ Ø 0ˆÔ؈Œ Ø(ˆÔØ&ˆÔØ(ˆÔØ$8ˆÔ!Ø ˆŒ
Ø"ˆŒØ.LˆÔ+Ø%:ˆÔ"Ø%:ˆÔ"Ø’} "ˆŒ Ø-JˆÔ*Ø%:ˆÔ"؈Œ
ð>
ð=
Ôð>9=ˆÔØ × Ò Ø—:’:Ð UÐUÓ U�:Ø—<’<Ð XÐ!XÓ X�<á Ü �N‰NðJô
ð"
Ò +œ×)Ñ)Ó+ð
Œ
ð#Ò4 nˆŒô"
‹Gð!
Œ
ðB
ð!
Ô!ô"*1×):Ñ):ØØ-Ø*.Ø!Ø#ØØ#9Ø%ØØ!Ø/ØØ(Cô*
ˆŒ ð"%Ð,‰B´$Ð7IÓ2Jð
Ôð
×Ñ×*Ñ*¬=Ô:PÔQØ ×Ñ×*Ñ*Ü "Ô$Hô
ð
×Ñ×*Ñ*Ü +ä :ô
ðÐ$‰B¬$¨zÓ*:ð
Ôð7;ˆÔØ �
‰
� ócój—|j}d}i}|jj«D]\}}|dtfvr|}Œ|||<Œt t
||¬«g|j zt t||¬«t t«gz}|j}t|«D]\}} }
||g| ¢­i|
¤Ž}Œ|S)Niô)Úhandlerr8)Úhandlersr8) r8rIÚitemsÚ Exceptionr#r%rjr&rrfÚreversed) r[r8Ú
error_handlerrIÚkeyÚvaluerHÚappÚclsÚargsÚkwargss rmÚbuild_middleware_stackzFastAPI.build_middleware_stackésØ€ð—
‘
ˆØˆ
Ø:<Ðà×1Ñ1×7Ñ7Ö9‰JˆC�Ø�sœIÐ&Ñ&Ø %‘
à*/Ð" 3Ò'ð :ôÔ-°}ÈEÔ
RÐ SØ×"Ñ"ñ
#ôÜ'Ð2DÈEôô,Ô3Ó4ð/ñ
ð ð<�k‰kˆÜ!)¨*Ö!5Ñ ˆC��vÙ�cÐ+˜DÒ+ FÑ+‰Cð"6àˆ
rocóš—|js´t|j|j|j|j
|j |j|j|j|j|jj|j|j|j|j¬«|_|jS)a
Generate the OpenAPI schema of the application. This is called by FastAPI
internally.
The first time it is called it stores the result in the attribute
`app.openapi_schema`, and next times it is called, it just returns that same
result. To avoid the cost of generating the schema every time.
If you need to modify the generated OpenAPI schema, you could modify it.
Read more in the
[FastAPI docs for OpenAPI](https://fastapi.tiangolo.com/how-to/extending-openapi/).
)r:r=r`r;r<rMrNrOr9rUÚtagsr@rYÚ
external_docs)rarr:r=r`r;r<rMrNrOr9rUr?r@rYrZ)r[s rmÚopenapizFastAPI.openapisž€ð×"Ò"Ü"-Ø—j‘jØŸ ™ Ø $× 4Ñ 4ØŸ ™ Ø ×,Ñ,Ø!%×!6Ñ!6ØŸ ™ Ø!×.Ñ.Ø—{‘{ØŸ™×-Ñ-Ø×&Ñ&ØŸ ™ Ø.2×.PÑ.PØ"×8Ñ8ô#ˆDÔ ð ×"Ñ"Ð"rocóp‡‡—‰jrWd„‰jD«}|D�chc]}|sŒ|’Œ c}Šdtdtfˆˆfd„ }‰j ‰j|d¬«‰jrv‰j
rjdtdt fˆfd„ }‰j ‰j
|d¬«‰jr.dtdt fd„}‰j ‰j|d¬«‰jr>‰jr1dtdt fˆfd „ }‰j ‰j|d¬«yyycc}w)
Nc3ó>K—|]}|jd«–—Œy­w)ÚurlN)Úget)Ú.0Ú server_datas rmÚ <genexpr>z FastAPI.setup.<locals>.<genexpr><sèø€ÐK¹l¨{�K—O‘O E×*¹lùs‚Úreqr]c“ó•K—|jjdd«jd«}|‰vr=|r;‰jr/‰jj dd|i«‰j
|«t‰j««S­w)NrQr7Ú/rr„) Úscoper…ÚrstriprRr@ÚinsertÚaddr)r�)r‰rQr[Ú server_urlss €€rmr�zFastAPI.setup.<locals>.openapi?soøèø€ØŸI™IŸM™M¨+°rÓ:×AÑAÀ#ÓF� Ø KÑ/Ù  T×%>Ò%>ØŸ ™ ×+Ñ+¨A°°yÐ/AÔBØ#Ÿ™¨ Ô2Ü# D§L¡L£NÓ3Ð3ùsƒBB F)rVc“ó•K—|jjdd«jd«}|‰jz}‰j}|r||z}t |‰j ›d�|‰j‰j¬«S­w)NrQr7r‹z
- Swagger UI)r>r:Úoauth2_redirect_urlÚ
init_oauthrW) rŒr…r�r>rFrr:rGrW)r‰rQr>r’r[s €rmÚswagger_ui_htmlz&FastAPI.setup.<locals>.swagger_ui_htmlJs„øèø€ØŸI™IŸM™M¨+°rÓ:×AÑAÀ#ÓF� Ø'¨$×*:Ñ*:Ñ:� Ø&*×&IÑ&IÐ#Ù&Ø*3Ð6IÑ*IÐ'Ü*Ø +Ø!ŸZ™Z˜L¨
Ð6Ø(;Ø#×9Ñ9Ø*.×*DÑ*Dô ðùsƒA?Bc“óK—t«S­w©N)r)r‰s rmÚswagger_ui_redirectz*FastAPI.setup.<locals>.swagger_ui_redirect\sèø€Ü>Ó@Ð@ùs‚
c“ó´•K—|jjdd«jd«}|‰jz}t |‰j
›d�¬«S­w)NrQr7r‹z - ReDoc)r>r:)rŒr…r�r>rr:)r‰rQr>r[s €rmÚ
redoc_htmlz!FastAPI.setup.<locals>.redoc_htmlfsSøèø€ØŸI™IŸM™M¨+°rÓ:×AÑAÀ#ÓF� Ø'¨$×*:Ñ*:Ñ:� Ü%Ø +°d·j±j°\ÀÐ3JôðùsƒAA) r>r@r'r)Ú add_routerDr(rFrE)r[Úurlsr„r�r”r—r™r�s` @rmrlz
FastAPI.setup:s"ù€Ø × Ò ÙK¸d¿lºlÓKˆDÙ*.Ó6©$ 3²#š3¨$Ñ6ˆKð
4¤7ð
4¬|ö
4ð
�N‰N˜4×+Ñ+¨WȈNÔ NØ × Ò  §
¢
ð
¬7ð
´|õ
ð
�N‰N˜4Ÿ=™=¨/ÈUˆNÔ Sà×2Ò2ðA´7ðA¼|óAð—‘Ø×7Ñ7Ø'Ø&+ðôð
× Ò  §¢ð
¤gð
´,õ
ð
�N‰N˜4Ÿ>™>¨:ȈNÕ Oð!/Ð ùòO7s
¦D3®D3rŒÚreceiveÚsendcƒóz•K—|jr|j|d<t‰|� |||«ƒd{–—†y7Œ­w)NrQ)rQÚsuperÚ__call__)r[rŒrœr�Ú __class__s €rmr zFastAPI.__call__os3øèø€Ø �>Š>Ø!%§¡ˆE�+Ñ Ü‰gјu g¨tÓ4×4Ò4ús ƒ0;³9´;zSuccessful Response©Úresponse_modelÚ status_coderrAr;r<Úresponse_descriptionrSr2ÚmethodsÚ operation_idÚresponse_model_includeÚresponse_model_excludeÚresponse_model_by_aliasÚresponse_model_exclude_unsetÚresponse_model_exclude_defaultsÚresponse_model_exclude_nonerVÚresponse_classÚnameÚ
openapi_extrarXÚpathÚendpoint.r£r¤rr¥r¦r§r¨r©rªr«r¬r­r®r¯r°cój—|jj||||||||| |
| | |
|||||||||||¬«y)N)r²r£r¤rrAr;r<r¥rSr2r¦r§r¨r©rªr«r¬r­rVr®r¯r°rX©rfÚ
add_api_route)r[r±r²r£r¤rrAr;r<r¥rSr2r¦r§r¨r©rªr«r¬r­rVr®r¯r°rXs rmrµzFastAPI.add_api_routetsd€ð@
� ‰ ×!Ñ!Ø ØØ)Ø#ØØ%ØØ#Ø!5ØØ!ØØ%Ø#9Ø#9Ø$;Ø)EØ,KØ(CØ/Ø)ØØ'Ø(Cð1 "õ
roc󈇇‡‡‡‡‡‡‡‡ ‡
‡ ‡ ‡
‡‡‡‡‡‡‡‡‡‡—dtdtfˆˆ
ˆˆˆˆ ˆˆˆ ˆˆˆˆˆˆˆˆˆˆ
ˆ ˆˆˆˆfd„ }|S)NÚfuncr]cón•—‰jj‰
|‰
‰‰‰‰‰‰ ‰‰‰‰ ‰‰‰‰‰‰‰‰ ‰‰‰¬«|S)Nr¢r´)r·rAr2r<rXrVr¦r¯r°r§r±r®r¥r£rªr©r¬r­r«r¨rSr[r¤r;rs €€€€€€€€€€€€€€€€€€€€€€€€rmÚ decoratorz$FastAPI.api_route.<locals>.decoratorÌsiø€Ø �K‰K× %Ñ %ØØØ-Ø'ØØ)ØØ'Ø%9Ø#Ø%ØØ)Ø'=Ø'=Ø(?Ø-IØ0OØ,GØ"3Ø-ØØ+Ø,Gð1
&ô
ð4ˆKro©r)r[r±r£r¤rrAr;r<r¥rSr2r¦r§r¨r©rªr«r¬r­rVr®r¯r°rXr¹s```````````````````````` rmÚ api_routezFastAPI.api_route¯s1ÿÿÿ€ð: Ô-ð Ô2C÷ ÷ ÷ ô ð:Ðro)rAcóB—|jj||||¬«y©N)r¯rA)rfÚadd_api_websocket_route)r[r±r²r¯rAs rmr¾zFastAPI.add_api_websocket_routeës'€ð
� ‰ ×+Ñ+Ø Ø ØØ%ð ,õ
roz1
WebSocket path.
zQ
A name for the WebSocket. Only used internally.
a
A list of dependencies (using `Depends()`) to be used for this
WebSocket.
Read more about it in the
[FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/).
có8‡‡‡‡—dtdtfˆˆˆˆfd„ }|S)a>
Decorate a WebSocket function.
Read more about it in the
[FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/).
**Example**
```python
from fastapi import FastAPI, WebSocket
app = FastAPI()
@app.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket):
await websocket.accept()
while True:
data = await websocket.receive_text()
await websocket.send_text(f"Message text was: {data}")
```
r·r]có2•—‰j‰|‰‰¬«|Sr½)r¾)r·rAr¯r±r[s €€€€rmr¹z$FastAPI.websocket.<locals>.decorator0s)ø€Ø × (Ñ (ØØØØ)ð
)ô
ð ˆKrorº)r[r±r¯rAr¹s```` rmÚ websocketzFastAPI.websocketús&û€ðl Ô-ð Ô2C÷ ð ðÐro© ÚprefixrrArSr2rVrBrTrXrfzThe `APIRouter` to include.rÃz'An optional path prefix for the router.a‚
A list of tags to be applied to all the *path operations* in this
router.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more about it in the
[FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/).
a2
A list of dependencies (using `Depends()`) to be applied to all the
*path operations* in this router.
Read more about it in the
[FastAPI docs for Bigger Applications - Multiple Files](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies).
**Example**
```python
from fastapi import Depends, FastAPI
from .dependencies import get_token_header
from .internal import admin
app = FastAPI()
app.include_router(
admin.router,
dependencies=[Depends(get_token_header)],
)
```
aü
Mark all the *path operations* in this router as deprecated.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
**Example**
```python
from fastapi import FastAPI
from .internal import old_api
app = FastAPI()
app.include_router(
old_api.router,
deprecated=True,
)
```
a+
Include (or not) all the *path operations* in this router in the
generated OpenAPI schema.
This affects the generated OpenAPI (e.g. visible at `/docs`).
**Example**
```python
from fastapi import FastAPI
from .internal import old_api
app = FastAPI()
app.include_router(
old_api.router,
include_in_schema=False,
)
```
aÚ
Default response class to be used for the *path operations* in this
router.
Read more in the
[FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#default-response-class).
**Example**
```python
from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
from .internal import old_api
app = FastAPI()
app.include_router(
old_api.router,
default_response_class=ORJSONResponse,
)
```
aÃ
List of *path operations* that will be used as OpenAPI callbacks.
This is only for OpenAPI documentation, the callbacks won't be used
directly.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more about it in the
[FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/).
c óN—|jj||||||||| |
¬«
y)a‹
Include an `APIRouter` in the same app.
Read more about it in the
[FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/).
## Example
```python
from fastapi import FastAPI
from .users import users_router
app = FastAPI()
app.include_router(users_router)
```
rÂN)rfÚinclude_router) r[rfrÃrrArSr2rVrBrTrXs rmrÅzFastAPI.include_router;s:€ð@
� ‰ ×"Ñ"Ø ØØØ%ØØ!Ø/Ø#9ØØ(Cð #õ
ro©r£r¤rrAr;r<r¥rSr2r§r¨r©rªr«r¬r­rVr®r¯rTr°rXz§
The URL path to be used for this *path operation*.
For example, in `http://example.com/items`, the path is `/items`.
a’
The type to use for the response.
It could be any valid Pydantic *field* type. So, it doesn't have to
be a Pydantic model, it could be other things, like a `list`, `dict`,
etc.
It will be used for:
* Documentation: the generated OpenAPI (and the UI at `/docs`) will
show it as the response (JSON Schema).
* Serialization: you could return an arbitrary object and the
`response_model` would be used to serialize that object into the
corresponding JSON.
* Filtering: the JSON sent to the client will only contain the data
(fields) defined in the `response_model`. If you returned an object
that contains an attribute `password` but the `response_model` does
not include that field, the JSON sent to the client would not have
that `password`.
* Validation: whatever you return will be serialized with the
`response_model`, converting any data as necessary to generate the
corresponding JSON. But if the data in the object returned is not
valid, that would mean a violation of the contract with the client,
so it's an error from the API developer. So, FastAPI will raise an
error and return a 500 error code (Internal Server Error).
Read more about it in the
[FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/).
aM
The default status code to be used for the response.
You could override the status code by returning a response directly.
Read more about it in the
[FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/).
ac
A list of tags to be applied to the *path operation*.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more about it in the
[FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags).
a[
A list of dependencies (using `Depends()`) to be applied to the
*path operation*.
Read more about it in the
[FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/).
aL
A summary for the *path operation*.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more about it in the
[FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/).
a
A description for the *path operation*.
If not provided, it will be extracted automatically from the docstring
of the *path operation function*.
It can contain Markdown.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
Read more about it in the
[FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/).
z¡
The description for the default response.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
z½
Additional responses that could be returned by this *path operation*.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
z¡
Mark this *path operation* as deprecated.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
a€
Custom operation ID to be used by this *path operation*.
By default, it is generated automatically.
If you provide a custom operation ID, you need to make sure it is
unique for the whole API.
You can customize the
operation ID generation with the parameter
`generate_unique_id_function` in the `FastAPI` class.
Read more about it in the
[FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function).
a\
Configuration passed to Pydantic to include only certain fields in the
response data.
Read more about it in the
[FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude).
aW
Configuration passed to Pydantic to exclude certain fields in the
response data.
Read more about it in the
[FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude).
a|
Configuration passed to Pydantic to define if the response model
should be serialized by alias when an alias is used.
Read more about it in the
[FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude).
aÜ
Configuration passed to Pydantic to define if the response data
should have all the fields, including the ones that were not set and
have their default values. This is different from
`response_model_exclude_defaults` in that if the fields are set,
they will be included in the response, even if the value is the same
as the default.
When `True`, default values are omitted from the response.
Read more about it in the
[FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter).
a¹
Configuration passed to Pydantic to define if the response data
should have all the fields, including the ones that have the same value
as the default. This is different from `response_model_exclude_unset`
in that if the fields are set but contain the same default values,
they will be excluded from the response.
When `True`, default values are omitted from the response.
Read more about it in the
[FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter).
a~
Configuration passed to Pydantic to define if the response data should
exclude fields set to `None`.
This is much simpler (less smart) than `response_model_exclude_unset`
and `response_model_exclude_defaults`. You probably want to use one of
those two instead of this one, as those allow returning `None` values
when it makes sense.
Read more about it in the
[FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none).
a‹
Include this *path operation* in the generated OpenAPI schema.
This affects the generated OpenAPI (e.g. visible at `/docs`).
Read more about it in the
[FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).
ae
Response class to be used for this *path operation*.
This will not be used if you return a response directly.
Read more about it in the
[FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse).
zW
Name for this *path operation*. Only used internally.
ah
Extra metadata to be included in the OpenAPI schema for this *path
operation*.
Read more about it in the
[FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema).
cóf—|jj||||||||| |
| | |
||||||||||¬«S)a)
Add a *path operation* using an HTTP GET operation.
## Example
```python
from fastapi import FastAPI
app = FastAPI()
@app.get("/items/")
def read_items():
return [{"name": "Empanada"}, {"name": "Arepa"}]
```
rÆ)rfr…©r[r±r£r¤rrAr;r<r¥rSr2r§r¨r©rªr«r¬r­rVr®r¯rTr°rXs rmr…z FastAPI.getsd€ðv
�{‰{�‰Ø Ø)Ø#ØØ%ØØ#Ø!5ØØ!Ø%Ø#9Ø#9Ø$;Ø)EØ,KØ(CØ/Ø)ØØØ'Ø(Cð/ó
ð
rocóf—|jj||||||||| |
| | |
||||||||||¬«S)aÖ
Add a *path operation* using an HTTP PUT operation.
## Example
```python
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
description: str | None = None
app = FastAPI()
@app.put("/items/{item_id}")
def replace_item(item_id: str, item: Item):
return {"message": "Item replaced", "id": item_id}
```
rÆ)rfÚputrÈs rmrÊz FastAPI.put}sd€ð@ �{‰{�‰Ø Ø)Ø#ØØ%ØØ#Ø!5ØØ!Ø%Ø#9Ø#9Ø$;Ø)EØ,KØ(CØ/Ø)ØØØ'Ø(Cð/ó
ð
rocóf—|jj||||||||| |
| | |
||||||||||¬«S)a°
Add a *path operation* using an HTTP POST operation.
## Example
```python
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
description: str | None = None
app = FastAPI()
@app.post("/items/")
def create_item(item: Item):
return {"message": "Item created"}
```
rÆ)rfÚpostrÈs rmrÌz FastAPI.post÷sf€ð@ �{‰{×ÑØ Ø)Ø#ØØ%ØØ#Ø!5ØØ!Ø%Ø#9Ø#9Ø$;Ø)EØ,KØ(CØ/Ø)ØØØ'Ø(Cð/ ó
ð
rocóf—|jj||||||||| |
| | |
||||||||||¬«S)a7
Add a *path operation* using an HTTP DELETE operation.
## Example
```python
from fastapi import FastAPI
app = FastAPI()
@app.delete("/items/{item_id}")
def delete_item(item_id: str):
return {"message": "Item deleted"}
```
rÆ)rfÚdeleterÈs rmrÎzFastAPI.deleteq
sf€ðv
�{‰{×!Ñ!Ø Ø)Ø#ØØ%ØØ#Ø!5ØØ!Ø%Ø#9Ø#9Ø$;Ø)EØ,KØ(CØ/Ø)ØØØ'Ø(Cð/"ó
ð
rocóf—|jj||||||||| |
| | |
||||||||||¬«S)a1
Add a *path operation* using an HTTP OPTIONS operation.
## Example
```python
from fastapi import FastAPI
app = FastAPI()
@app.options("/items/")
def get_item_options():
return {"additions": ["Aji", "Guacamole"]}
```
rÆ)rfÚoptionsrÈs rmrÐzFastAPI.optionsæ sf€ðv
�{‰{×"Ñ"Ø Ø)Ø#ØØ%ØØ#Ø!5ØØ!Ø%Ø#9Ø#9Ø$;Ø)EØ,KØ(CØ/Ø)ØØØ'Ø(Cð/#ó
ð
rocóf—|jj||||||||| |
| | |
||||||||||¬«S)ac
Add a *path operation* using an HTTP HEAD operation.
## Example
```python
from fastapi import FastAPI, Response
app = FastAPI()
@app.head("/items/", status_code=204)
def get_items_headers(response: Response):
response.headers["X-Cat-Dog"] = "Alone in the world"
```
rÆ)rfÚheadrÈs rmrÒz FastAPI.head[
sf€ðv
�{‰{×ÑØ Ø)Ø#ØØ%ØØ#Ø!5ØØ!Ø%Ø#9Ø#9Ø$;Ø)EØ,KØ(CØ/Ø)ØØØ'Ø(Cð/ ó
ð
rocóf—|jj||||||||| |
| | |
||||||||||¬«S)a»
Add a *path operation* using an HTTP PATCH operation.
## Example
```python
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
description: str | None = None
app = FastAPI()
@app.patch("/items/")
def update_item(item: Item):
return {"message": "Item updated in place"}
```
rÆ)rfÚpatchrÈs rmrÔz
FastAPI.patchÐsf€ð@ �{‰{× Ñ Ø Ø)Ø#ØØ%ØØ#Ø!5ØØ!Ø%Ø#9Ø#9Ø$;Ø)EØ,KØ(CØ/Ø)ØØØ'Ø(Cð/!ó
ð
rocóf—|jj||||||||| |
| | |
||||||||||¬«S)a
Add a *path operation* using an HTTP TRACE operation.
## Example
```python
from fastapi import FastAPI
app = FastAPI()
@app.trace("/items/{item_id}")
def trace_item(item_id: str):
return None
```
rÆ)rfÚtracerÈs rmrÖz
FastAPI.traceJsf€ðv
�{‰{× Ñ Ø Ø)Ø#ØØ%ØØ#Ø!5ØØ!Ø%Ø#9Ø#9Ø$;Ø)EØ,KØ(CØ/Ø)ØØØ'Ø(Cð/!ó
ð
rocó4‡‡‡—dtdtfˆˆˆfd„ }|S)Nr·r]cóD•—‰jj‰|‰¬«|S)N)r¯)rfÚadd_websocket_route)r·r¯r±r[s €€€rmr¹z*FastAPI.websocket_route.<locals>.decoratorÂs!ø€Ø �K‰K× +Ñ +¨D°$¸TÐ +Ô B؈Krorº)r[r±r¯r¹s``` rmÚwebsocket_routezFastAPI.websocket_route¿s ú€ð Ô-ð Ô2C÷ ðÐrozÌ
on_event is deprecated, use lifespan event handlers instead.
Read more about it in the
[FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/).
Ú
event_typezM
The type of event. `startup` or `shutdown`.
có8—|jj|«S)a!
Add an event handler for the application.
`on_event` is deprecated, use `lifespan` event handlers instead.
Read more about it in the
[FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/#alternative-events-deprecated).
)rfÚon_event)r[rÛs rmrÝzFastAPI.on_eventÈs€ð6�{‰{×#Ñ# JÓ/Ð/roÚmiddleware_typezY
The type of middleware. Currently only supports `http`.
có,‡—dtdtfˆfd„ }|S)a
Add a middleware to the application.
Read more about it in the
[FastAPI docs for Middleware](https://fastapi.tiangolo.com/tutorial/middleware/).
## Example
```python
import time
from typing import Awaitable, Callable
from fastapi import FastAPI, Request, Response
app = FastAPI()
@app.middleware("http")
async def add_process_time_header(
request: Request, call_next: Callable[[Request], Awaitable[Response]]
) -> Response:
start_time = time.time()
response = await call_next(request)
process_time = time.time() - start_time
response.headers["X-Process-Time"] = str(process_time)
return response
```
r·r]có6•—‰jt|¬«|S)N)Údispatch)Úadd_middlewarer$)r·r[s €rmr¹z%FastAPI.middleware.<locals>.decorator
sø€Ø × Ñ Ô 2¸TÐ Ô B؈Krorº)r[rÞr¹s` rmrHzFastAPI.middlewareås!ø€ðP Ô-ð Ô2Cõ ðÐroÚexc_class_or_status_codezZ
The Exception class this would handle, or a status code.
có0‡‡—dtdtfˆˆfd„ }|S)a
Add an exception handler to the app.
Read more about it in the
[FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).
## Example
```python
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
class UnicornException(Exception):
def __init__(self, name: str):
self.name = name
app = FastAPI()
@app.exception_handler(UnicornException)
async def unicorn_exception_handler(request: Request, exc: UnicornException):
return JSONResponse(
status_code=418,
content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."},
)
```
r·r]có,•—‰j‰|«|Sr–)Úadd_exception_handler)r·rãr[s €€rmr¹z,FastAPI.exception_handler.<locals>.decorator<sø€Ø × &Ñ &Ð'?ÀÔ F؈Krorº)r[rãr¹s`` rmÚexception_handlerzFastAPI.exception_handlers!ù€ðR Ô-ð Ô2Cö ðÐro)r]Nr–)@Ú__name__Ú
__module__Ú __qualname__Ú__doc__rr)rr3rÚboolr
r
rir+r2Ústrrgrr rrÚtyper*r#Úintrtr r'rr.rrcÚAPIRouternr,r}r�rlr0r/r1r rrrrµrr»r¾rÁrÅr…rÊrÌrÎrÐrÒrÔrÖrÚrÝrHrçÚ
__classcell__)r¡s@rmr4r40s­5ø„ñ
ð:
ð,
ð*
ð*
ðL
ð0
ð.
ðx
ðb
ð,
ñ(
�LÓ !ð2
ð0
ð0
ð
$ð
ð
ð&
ð
ð
ð
ð&
ðB
ðD
ð
ð(
ð(
ð
ð
ð
ð
ð
ð
ñ
Ð&Ó 'ðD
ð4
ò]gØðgðØ Ù ðó
ð
ñ 
ðgðØ �T˜)‘_Ñ %Ù ðó
ñ
ðó
ð
ñ
ðgðJØ Ù ðó
ð
ñ
ðKgðtØ �S‰MÙ ðó
ð
ñ
ðugð^Ø Ù ð ó"
ð#
ñ%
ð_gðjØ Ù ðó
ð
ñ
ðkgðZØ �S‰MÙ ðó
ð
ñ
ð[gðH Ø �T˜$˜s C˜x™.Ñ)Ñ *Ù ð6ó8
ð9
ñ;
ðIgð@Ø �T˜$˜s E¨#¨s¨(¡OÐ3Ñ4Ñ5Ñ 6Ù ð+ó-
ð.
ñ0
ðAgðb Ø �X˜gÑ&Ñ 'Ù ðó
ð
ñ
ðcgðN !*Ø �‰NÙ ðó
ð
ñ!
ðO gðv $Ø Ù ðó
ð
ñ
ðw gðh
Ø �S‰MÙ ðó
ð
ñ
ði
gðX Ø �S‰MÙ ðó
ð
ñ
ðY gðH )2Ø �S‰MÙ ðó
ð
ñ )
ðI gðb )Ø �T˜#˜s˜(‘^Ñ $Ù ðó
ð
ñ
ðc gðx Ø �X˜jÑ)Ñ *Ù ðó
ð
ñ

ðy gðT
&Ø ØØ˜#˜t I™Ð.Ñ/ؘg s˜^¨Y°s¸CÀÐ7IÑ-JÐJÑKðMññ
ñ
ðó
ð

ñ
ðU
gðz
Ø �X˜h r¨3 wÑ/Ñ0Ñ 1Ù ðó
ð
ñ 
ð{
gðRØ �X˜h r¨3 wÑ/Ñ0Ñ 1Ù ðó
ð
ñ 
ðSgðlØ �X˜gÑ&Ñ 'Ù ðó
ð
ñ 
ðmgðD$Ø �S‰MÙ ð
ó
ð
ñ
ðEgðjØ �T˜#˜u S¨# X™Ð.Ñ/Ñ 0Ù ðó
ð
ñ 
ðkgðl Ø �T˜#˜u S¨# X™Ð.Ñ/Ñ 0Ù ðó
ð
ñ!
ðmgðp"Ø Ù ðó
ñ
ðó
ð
ñ
ðqgðNØ Ù ðó
ð
ñ
ðOgðv(Ø Ù ðó
ð
ñ
ðwgð^Ø �T˜%  S ™/¨4°°S°©>Ð9Ñ:Ñ ;Ù ð
ó
ð
ñ
ð_gð~Ø �T˜)‘_Ñ %Ù ðó
ð
ñ 
ðgðXØ �W×&Ñ&Ñ 'Ù ð
ó
ð
ñ
ðYgðxØ �T‰NÙ ðó
ð
ñ

ðygðT%Ø Ù ðó
ð
ñ

ðUgðp )Ø �T˜#˜s˜(‘^Ñ $Ù ðó
ð
ñ
ðqgðH&/Ø �g×&Ñ&Ð'¨Ð,Ñ -Ù ð ó
ð
ñ&
ðIgðf(1Ø Ù ðó
ð
ñ!(
ðggðj )Ø �T˜#˜s˜(‘^Ñ $Ù ðó
ð
ñ
ðkgð^Ø Ù ðó
ð
ñ
ð_gðp
óqgðR.¨ó.ð`#˜˜c 3˜h™ó#óB3Pðj5 Eð5°Gð5À4ð5ÈDõ5ñ& d›mØ%)Ø15Ø48Ø!%Ø%)Ø$9ØEIØ%)Ø'+Ø&*Ø26Ø26Ø(,Ø-2Ø05Ø,1Ø"&ÙDKØ óE
ð#Ø26ÙIPØ óJ
ò99
àð9
ð˜3 ˜8Ñ$ð9
ð
ð 9
ð ˜c‘]ð
9
ð�t˜E # t )Ñ,Ñ-Ñ.ð9
ð˜x¨Ñ0Ñ1ð9
ð˜#‘ð9
ð˜c‘]ð9
ð"ð9
ð˜D  s¨C x¡°$°s¸C°x±.Ð!@ÑAÑBð9
ð˜T‘Nð9
ð˜$˜s™)Ñ$ð9
ð˜s‘mð9
ð !)¨¡ð!9
ð"!)¨¡ð#9
ð$"&ð%9
ð&'+ð'9
ð(*.ð)9
ð*&*ð+9
ð, ð-9
ð.˜d 8™nÐ.@Ð@ÑAð/9
ð4�s‰mð59
ð6   S¨# X¡Ñ/ð79
ð8&.¨w×/?Ñ/?Ð.@À#Ð.EÑ%Fð99
ð>
ó?9
ñ~& d›mØ%)Ø15Ø48Ø!%Ø%)Ø$9ØEIØ%)Ø'+Ø&*Ø26Ø26Ø(,Ø-2Ø05Ø,1Ø"&Ù)0°Ó)>Ø"Ø26ÙIPØ óJ
ò3:àð:ðð :ð
˜c‘]ð :ð �t˜E # t )Ñ,Ñ-Ñ.ð
:ð˜x¨Ñ0Ñ1ð:ð˜#‘ð:ð˜c‘]ð:ð"ð:ð˜D  s¨C x¡°$°s¸C°x±.Ð!@ÑAÑBð:ð˜T‘Nð:ð˜$˜s™)Ñ$ð:ð˜s‘mð:ð!)¨¡ð:ð !)¨¡ð!:ð""&ð#:ð$'+ð%:ð&*.ð':ð(&*ð):ð* ð+:ð,˜X™ð-:ð.�s‰mð/:ð0   S¨# X¡Ñ/ð1:ð2&.¨w×/?Ñ/?Ð.@À#Ð.EÑ%Fð3:ð8
Ð$Ð%Ð'8Ð8Ñ 9ó9:ð@#ð

ð 59ò

àð

ð˜3 ˜8Ñ$ð

ð�s‰mð

ð ˜x¨Ñ0Ñ1ð

ð
ó

ð@
ð#?ð<
ò=?àØ Ù ðó
ð
ñ
ð?ðØ �S‰MÙ ðó
ð
ñ
ð?ð& Ø �X˜gÑ&Ñ 'Ù ðó
ð
ñ 
ð'?ð>
Ð$Ð%Ð'8Ð8Ñ 9ó??ðJRTð
ð8
ð
ð2
ð4
ñ8
�LÓ !ð
ñ
Ð&Ó 'òYK
à˜'×+Ñ+©SÐ1NÓ-OÐOÑPðK
ð˜#™sÐ#LÓMÐMÑNð K
ð
Ø �T˜%  T  Ñ*Ñ+Ñ ,Ù ðó
ð
ñ

ð K
ð& Ø �X˜gÑ&Ñ 'Ù ðó
ð
ñ
ð'K
ð^Ø �T˜%  S ™/¨4°°S°©>Ð9Ñ:Ñ ;Ù ð
ó
ð
ñ
ð_K
ð~Ø �T‰NÙ ðó
ð
ñ
ðK
ðp%Ø Ù ðó
ð
ñ
ðqK
ðd!*Ø �‰NÙ ðó
ð
ñ!
ðeK
ð\Ø �T˜)‘_Ñ %Ù ð
ó
ð
ñ
ð]K
ð|&/Ø �g×&Ñ&Ð'¨Ð,Ñ -Ù ð ó
ð
ñ&
ð}K
ðZ
ó[K
ñv
�D‹Mð
ð
ð
ð
ð$
ð
"ð
ð
ð(
ð
ð
ð
ð$
ð"
ð"
ð
ñ
�LÓ !ð
ð
ð
ñ
Ð&Ó 'òU
s
àØ Ù ðó
ð
ñ 
ðs
ð"Ø Ù ðó
ð
ñ!
ðs
ð^Ø �S‰MÙ ðó
ð
ñ 
ð_s
ðxØ �T˜%  T  Ñ*Ñ+Ñ ,Ù ðó
ð
ñ 
ðys
ðR Ø �X˜gÑ&Ñ 'Ù ðó
ð
ñ 
ðSs
ðjØ �S‰MÙ ðó
ð
ñ 
ðks
ðDØ �S‰MÙ ð ó
ð
ñ
ðEs
ðh(Ø Ù ðó
ð
ñ 
ðis
ð|Ø �T˜%  S ™/¨4°°S°©>Ð9Ñ:Ñ ;Ù ðó
ð
ñ 
ð}s
ðPØ �T‰NÙ ðó
ð
ñ 
ðQs
ðd Ø �S‰MÙ ðó
ð
ñ
ðes
ðL!*Ø �U‰OÙ ðó
ð
ñ !
ðMs
ðd!*Ø �U‰OÙ ðó
ð
ñ !
ðes
ð|"+Ø Ù ðó
ð
ñ "
ð}s
ðT'0Ø Ù ð ó
ð
ñ'
ðUs
ðx*3Ø Ù ð ó
ð
ñ*
ðys
ðZ&/Ø Ù ð ó
ð
ñ&
ð[s
ð|%Ø Ù ðó
ð
ñ 
ð}s
ðV"Ø �‰NÙ ðó
ð
ñ 
ðWs
ðpØ �S‰MÙ ðó
ð
ñ
ðqs
ð@ Ø �T˜)‘_Ñ %Ù ð
ó
ð
ñ
ðA s
ð` !Ø �T˜#˜s˜(‘^Ñ $Ù ðó
ð
ñ 
ða s
ðx &/Ø �g×&Ñ&Ð'¨Ð,Ñ -Ù ð ó
ð
ñ&
ðy s
ðV
Ð$Ð%Ð'8Ð8Ñ 9óW
s
ñF
�D‹Mð
ð
ð
ð
ð$
ð
"ð
ð
ð(
ð
ð
ð
ð$
ð"
ð"
ð
ñ
�LÓ !ð
ð
ð
ñ
Ð&Ó 'òU
x
àØ Ù ðó
ð
ñ 
ðx
ð"Ø Ù ðó
ð
ñ!
ðx
ð^Ø �S‰MÙ ðó
ð
ñ 
ð_x
ðxØ �T˜%  T  Ñ*Ñ+Ñ ,Ù ðó
ð
ñ 
ðyx
ðR Ø �X˜gÑ&Ñ 'Ù ðó
ð
ñ 
ðSx
ðjØ �S‰MÙ ðó
ð
ñ 
ðkx
ðDØ �S‰MÙ ð ó
ð
ñ
ðEx
ðh(Ø Ù ðó
ð
ñ 
ðix
ð|Ø �T˜%  S ™/¨4°°S°©>Ð9Ñ:Ñ ;Ù ðó
ð
ñ 
ð}x
ðPØ �T‰NÙ ðó
ð
ñ 
ðQx
ðd Ø �S‰MÙ ðó
ð
ñ
ðex
ðL!*Ø �U‰OÙ ðó
ð
ñ !
ðMx
ðd!*Ø �U‰OÙ ðó
ð
ñ !
ðex
ð|"+Ø Ù ðó
ð
ñ "