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.
Files changed (53) hide show
  1. fastapi/__init__.py +25 -0
  2. fastapi/__main__.py +3 -0
  3. fastapi/_compat/__init__.py +41 -0
  4. fastapi/_compat/shared.py +206 -0
  5. fastapi/_compat/v2.py +568 -0
  6. fastapi/applications.py +4669 -0
  7. fastapi/background.py +60 -0
  8. fastapi/cli.py +13 -0
  9. fastapi/concurrency.py +41 -0
  10. fastapi/datastructures.py +183 -0
  11. fastapi/dependencies/__init__.py +0 -0
  12. fastapi/dependencies/models.py +193 -0
  13. fastapi/dependencies/utils.py +1021 -0
  14. fastapi/encoders.py +346 -0
  15. fastapi/exception_handlers.py +34 -0
  16. fastapi/exceptions.py +246 -0
  17. fastapi/logger.py +3 -0
  18. fastapi/middleware/__init__.py +1 -0
  19. fastapi/middleware/asyncexitstack.py +18 -0
  20. fastapi/middleware/cors.py +1 -0
  21. fastapi/middleware/gzip.py +1 -0
  22. fastapi/middleware/httpsredirect.py +3 -0
  23. fastapi/middleware/trustedhost.py +3 -0
  24. fastapi/middleware/wsgi.py +1 -0
  25. fastapi/openapi/__init__.py +0 -0
  26. fastapi/openapi/constants.py +3 -0
  27. fastapi/openapi/docs.py +344 -0
  28. fastapi/openapi/models.py +438 -0
  29. fastapi/openapi/utils.py +567 -0
  30. fastapi/param_functions.py +2369 -0
  31. fastapi/params.py +755 -0
  32. fastapi/py.typed +0 -0
  33. fastapi/requests.py +2 -0
  34. fastapi/responses.py +48 -0
  35. fastapi/routing.py +4508 -0
  36. fastapi/security/__init__.py +15 -0
  37. fastapi/security/api_key.py +318 -0
  38. fastapi/security/base.py +6 -0
  39. fastapi/security/http.py +423 -0
  40. fastapi/security/oauth2.py +663 -0
  41. fastapi/security/open_id_connect_url.py +94 -0
  42. fastapi/security/utils.py +10 -0
  43. fastapi/staticfiles.py +1 -0
  44. fastapi/templating.py +1 -0
  45. fastapi/testclient.py +1 -0
  46. fastapi/types.py +11 -0
  47. fastapi/utils.py +164 -0
  48. fastapi/websockets.py +3 -0
  49. fastapi-0.128.0.dist-info/METADATA +645 -0
  50. fastapi-0.128.0.dist-info/RECORD +53 -0
  51. fastapi-0.128.0.dist-info/WHEEL +4 -0
  52. fastapi-0.128.0.dist-info/entry_points.txt +5 -0
  53. fastapi-0.128.0.dist-info/licenses/LICENSE +21 -0
fastapi/py.typed ADDED
File without changes
fastapi/requests.py ADDED
@@ -0,0 +1,2 @@
1
+ from starlette.requests import HTTPConnection as HTTPConnection # noqa: F401
2
+ from starlette.requests import Request as Request # noqa: F401
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
+ )