fastapi 0.128.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastapi/__init__.py +25 -0
- fastapi/__main__.py +3 -0
- fastapi/_compat/__init__.py +41 -0
- fastapi/_compat/shared.py +206 -0
- fastapi/_compat/v2.py +568 -0
- fastapi/applications.py +4669 -0
- fastapi/background.py +60 -0
- fastapi/cli.py +13 -0
- fastapi/concurrency.py +41 -0
- fastapi/datastructures.py +183 -0
- fastapi/dependencies/__init__.py +0 -0
- fastapi/dependencies/models.py +193 -0
- fastapi/dependencies/utils.py +1021 -0
- fastapi/encoders.py +346 -0
- fastapi/exception_handlers.py +34 -0
- fastapi/exceptions.py +246 -0
- fastapi/logger.py +3 -0
- fastapi/middleware/__init__.py +1 -0
- fastapi/middleware/asyncexitstack.py +18 -0
- fastapi/middleware/cors.py +1 -0
- fastapi/middleware/gzip.py +1 -0
- fastapi/middleware/httpsredirect.py +3 -0
- fastapi/middleware/trustedhost.py +3 -0
- fastapi/middleware/wsgi.py +1 -0
- fastapi/openapi/__init__.py +0 -0
- fastapi/openapi/constants.py +3 -0
- fastapi/openapi/docs.py +344 -0
- fastapi/openapi/models.py +438 -0
- fastapi/openapi/utils.py +567 -0
- fastapi/param_functions.py +2369 -0
- fastapi/params.py +755 -0
- fastapi/py.typed +0 -0
- fastapi/requests.py +2 -0
- fastapi/responses.py +48 -0
- fastapi/routing.py +4508 -0
- fastapi/security/__init__.py +15 -0
- fastapi/security/api_key.py +318 -0
- fastapi/security/base.py +6 -0
- fastapi/security/http.py +423 -0
- fastapi/security/oauth2.py +663 -0
- fastapi/security/open_id_connect_url.py +94 -0
- fastapi/security/utils.py +10 -0
- fastapi/staticfiles.py +1 -0
- fastapi/templating.py +1 -0
- fastapi/testclient.py +1 -0
- fastapi/types.py +11 -0
- fastapi/utils.py +164 -0
- fastapi/websockets.py +3 -0
- fastapi-0.128.0.dist-info/METADATA +645 -0
- fastapi-0.128.0.dist-info/RECORD +53 -0
- fastapi-0.128.0.dist-info/WHEEL +4 -0
- fastapi-0.128.0.dist-info/entry_points.txt +5 -0
- fastapi-0.128.0.dist-info/licenses/LICENSE +21 -0
fastapi/py.typed
ADDED
|
File without changes
|
fastapi/requests.py
ADDED
fastapi/responses.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from starlette.responses import FileResponse as FileResponse # noqa
|
|
4
|
+
from starlette.responses import HTMLResponse as HTMLResponse # noqa
|
|
5
|
+
from starlette.responses import JSONResponse as JSONResponse # noqa
|
|
6
|
+
from starlette.responses import PlainTextResponse as PlainTextResponse # noqa
|
|
7
|
+
from starlette.responses import RedirectResponse as RedirectResponse # noqa
|
|
8
|
+
from starlette.responses import Response as Response # noqa
|
|
9
|
+
from starlette.responses import StreamingResponse as StreamingResponse # noqa
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
import ujson
|
|
13
|
+
except ImportError: # pragma: nocover
|
|
14
|
+
ujson = None # type: ignore
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
import orjson
|
|
19
|
+
except ImportError: # pragma: nocover
|
|
20
|
+
orjson = None # type: ignore
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class UJSONResponse(JSONResponse):
|
|
24
|
+
"""
|
|
25
|
+
JSON response using the high-performance ujson library to serialize data to JSON.
|
|
26
|
+
|
|
27
|
+
Read more about it in the
|
|
28
|
+
[FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/).
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def render(self, content: Any) -> bytes:
|
|
32
|
+
assert ujson is not None, "ujson must be installed to use UJSONResponse"
|
|
33
|
+
return ujson.dumps(content, ensure_ascii=False).encode("utf-8")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ORJSONResponse(JSONResponse):
|
|
37
|
+
"""
|
|
38
|
+
JSON response using the high-performance orjson library to serialize data to JSON.
|
|
39
|
+
|
|
40
|
+
Read more about it in the
|
|
41
|
+
[FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/).
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
def render(self, content: Any) -> bytes:
|
|
45
|
+
assert orjson is not None, "orjson must be installed to use ORJSONResponse"
|
|
46
|
+
return orjson.dumps(
|
|
47
|
+
content, option=orjson.OPT_NON_STR_KEYS | orjson.OPT_SERIALIZE_NUMPY
|
|
48
|
+
)
|