django-bolt 0.1.0__cp310-abi3-win_amd64.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.

Potentially problematic release.


This version of django-bolt might be problematic. Click here for more details.

Files changed (128) hide show
  1. django_bolt/__init__.py +147 -0
  2. django_bolt/_core.pyd +0 -0
  3. django_bolt/admin/__init__.py +25 -0
  4. django_bolt/admin/admin_detection.py +179 -0
  5. django_bolt/admin/asgi_bridge.py +267 -0
  6. django_bolt/admin/routes.py +91 -0
  7. django_bolt/admin/static.py +155 -0
  8. django_bolt/admin/static_routes.py +111 -0
  9. django_bolt/api.py +1011 -0
  10. django_bolt/apps.py +7 -0
  11. django_bolt/async_collector.py +228 -0
  12. django_bolt/auth/README.md +464 -0
  13. django_bolt/auth/REVOCATION_EXAMPLE.md +391 -0
  14. django_bolt/auth/__init__.py +84 -0
  15. django_bolt/auth/backends.py +236 -0
  16. django_bolt/auth/guards.py +224 -0
  17. django_bolt/auth/jwt_utils.py +212 -0
  18. django_bolt/auth/revocation.py +286 -0
  19. django_bolt/auth/token.py +335 -0
  20. django_bolt/binding.py +363 -0
  21. django_bolt/bootstrap.py +77 -0
  22. django_bolt/cli.py +133 -0
  23. django_bolt/compression.py +104 -0
  24. django_bolt/decorators.py +159 -0
  25. django_bolt/dependencies.py +128 -0
  26. django_bolt/error_handlers.py +305 -0
  27. django_bolt/exceptions.py +294 -0
  28. django_bolt/health.py +129 -0
  29. django_bolt/logging/__init__.py +6 -0
  30. django_bolt/logging/config.py +357 -0
  31. django_bolt/logging/middleware.py +296 -0
  32. django_bolt/management/__init__.py +1 -0
  33. django_bolt/management/commands/__init__.py +0 -0
  34. django_bolt/management/commands/runbolt.py +427 -0
  35. django_bolt/middleware/__init__.py +32 -0
  36. django_bolt/middleware/compiler.py +131 -0
  37. django_bolt/middleware/middleware.py +247 -0
  38. django_bolt/openapi/__init__.py +23 -0
  39. django_bolt/openapi/config.py +196 -0
  40. django_bolt/openapi/plugins.py +439 -0
  41. django_bolt/openapi/routes.py +152 -0
  42. django_bolt/openapi/schema_generator.py +581 -0
  43. django_bolt/openapi/spec/__init__.py +68 -0
  44. django_bolt/openapi/spec/base.py +74 -0
  45. django_bolt/openapi/spec/callback.py +24 -0
  46. django_bolt/openapi/spec/components.py +72 -0
  47. django_bolt/openapi/spec/contact.py +21 -0
  48. django_bolt/openapi/spec/discriminator.py +25 -0
  49. django_bolt/openapi/spec/encoding.py +67 -0
  50. django_bolt/openapi/spec/enums.py +41 -0
  51. django_bolt/openapi/spec/example.py +36 -0
  52. django_bolt/openapi/spec/external_documentation.py +21 -0
  53. django_bolt/openapi/spec/header.py +132 -0
  54. django_bolt/openapi/spec/info.py +50 -0
  55. django_bolt/openapi/spec/license.py +28 -0
  56. django_bolt/openapi/spec/link.py +66 -0
  57. django_bolt/openapi/spec/media_type.py +51 -0
  58. django_bolt/openapi/spec/oauth_flow.py +36 -0
  59. django_bolt/openapi/spec/oauth_flows.py +28 -0
  60. django_bolt/openapi/spec/open_api.py +87 -0
  61. django_bolt/openapi/spec/operation.py +105 -0
  62. django_bolt/openapi/spec/parameter.py +147 -0
  63. django_bolt/openapi/spec/path_item.py +78 -0
  64. django_bolt/openapi/spec/paths.py +27 -0
  65. django_bolt/openapi/spec/reference.py +38 -0
  66. django_bolt/openapi/spec/request_body.py +38 -0
  67. django_bolt/openapi/spec/response.py +48 -0
  68. django_bolt/openapi/spec/responses.py +44 -0
  69. django_bolt/openapi/spec/schema.py +678 -0
  70. django_bolt/openapi/spec/security_requirement.py +28 -0
  71. django_bolt/openapi/spec/security_scheme.py +69 -0
  72. django_bolt/openapi/spec/server.py +34 -0
  73. django_bolt/openapi/spec/server_variable.py +32 -0
  74. django_bolt/openapi/spec/tag.py +32 -0
  75. django_bolt/openapi/spec/xml.py +44 -0
  76. django_bolt/pagination.py +669 -0
  77. django_bolt/param_functions.py +49 -0
  78. django_bolt/params.py +337 -0
  79. django_bolt/request_parsing.py +128 -0
  80. django_bolt/responses.py +214 -0
  81. django_bolt/router.py +48 -0
  82. django_bolt/serialization.py +193 -0
  83. django_bolt/status_codes.py +321 -0
  84. django_bolt/testing/__init__.py +10 -0
  85. django_bolt/testing/client.py +274 -0
  86. django_bolt/testing/helpers.py +93 -0
  87. django_bolt/tests/__init__.py +0 -0
  88. django_bolt/tests/admin_tests/__init__.py +1 -0
  89. django_bolt/tests/admin_tests/conftest.py +6 -0
  90. django_bolt/tests/admin_tests/test_admin_with_django.py +278 -0
  91. django_bolt/tests/admin_tests/urls.py +9 -0
  92. django_bolt/tests/cbv/__init__.py +0 -0
  93. django_bolt/tests/cbv/test_class_views.py +570 -0
  94. django_bolt/tests/cbv/test_class_views_django_orm.py +703 -0
  95. django_bolt/tests/cbv/test_class_views_features.py +1173 -0
  96. django_bolt/tests/cbv/test_class_views_with_client.py +622 -0
  97. django_bolt/tests/conftest.py +165 -0
  98. django_bolt/tests/test_action_decorator.py +399 -0
  99. django_bolt/tests/test_auth_secret_key.py +83 -0
  100. django_bolt/tests/test_decorator_syntax.py +159 -0
  101. django_bolt/tests/test_error_handling.py +481 -0
  102. django_bolt/tests/test_file_response.py +192 -0
  103. django_bolt/tests/test_global_cors.py +172 -0
  104. django_bolt/tests/test_guards_auth.py +441 -0
  105. django_bolt/tests/test_guards_integration.py +303 -0
  106. django_bolt/tests/test_health.py +283 -0
  107. django_bolt/tests/test_integration_validation.py +400 -0
  108. django_bolt/tests/test_json_validation.py +536 -0
  109. django_bolt/tests/test_jwt_auth.py +327 -0
  110. django_bolt/tests/test_jwt_token.py +458 -0
  111. django_bolt/tests/test_logging.py +837 -0
  112. django_bolt/tests/test_logging_merge.py +419 -0
  113. django_bolt/tests/test_middleware.py +492 -0
  114. django_bolt/tests/test_middleware_server.py +230 -0
  115. django_bolt/tests/test_model_viewset.py +323 -0
  116. django_bolt/tests/test_models.py +24 -0
  117. django_bolt/tests/test_pagination.py +1258 -0
  118. django_bolt/tests/test_parameter_validation.py +178 -0
  119. django_bolt/tests/test_syntax.py +626 -0
  120. django_bolt/tests/test_testing_utilities.py +163 -0
  121. django_bolt/tests/test_testing_utilities_simple.py +123 -0
  122. django_bolt/tests/test_viewset_unified.py +346 -0
  123. django_bolt/typing.py +273 -0
  124. django_bolt/views.py +1110 -0
  125. django_bolt-0.1.0.dist-info/METADATA +629 -0
  126. django_bolt-0.1.0.dist-info/RECORD +128 -0
  127. django_bolt-0.1.0.dist-info/WHEEL +4 -0
  128. django_bolt-0.1.0.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,28 @@
1
+ from typing_extensions import TypeAlias
2
+
3
+ SecurityRequirement: TypeAlias = "dict[str, list[str]]"
4
+ """Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a
5
+ security scheme declared in the.
6
+
7
+ `Security Schemes <https://spec.openapis.org/oas/v3.1.0#componentsSecuritySchemes>`_ under the
8
+ `Components Object <https://spec.openapis.org/oas/v3.1.0#componentsObject>`_.
9
+
10
+ Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to
11
+ be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey
12
+ security information.
13
+
14
+ When a list of Security Requirement Objects is defined on the
15
+ `OpenAPI Object <https://spec.openapis.org/oas/v3.1.0#oasObject>`_ or
16
+ `Operation Object <https://spec.openapis.org/oas/v3.1.0#operationObject>`_, only one of the Security Requirement
17
+ Objects in the list needs to be satisfied to authorize the request.
18
+
19
+ Patterned Fields
20
+
21
+ {name}: ``List[str]``
22
+ Each name MUST correspond to a security scheme which is declared
23
+ in the `Security Schemes <https://spec.openapis.org/oas/v3.1.0#componentsSecuritySchemes>`_ under the
24
+ `Components Object <https://spec.openapis.org/oas/v3.1.0#componentsObject>`_. if the security scheme is of type
25
+ ``"oauth2"`` or ``"openIdConnect"``, then the value is a list of scope names required for the execution, and the list
26
+ MAY be empty if authorization does not require a specified scope. For other security scheme types, the array MAY contain
27
+ a list of role names which are required for the execution,but are not otherwise defined or exchanged in-band.
28
+ """
@@ -0,0 +1,69 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING, Literal
5
+
6
+ from .base import BaseSchemaObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .oauth_flows import OAuthFlows
10
+
11
+ __all__ = ("SecurityScheme",)
12
+
13
+
14
+ @dataclass
15
+ class SecurityScheme(BaseSchemaObject):
16
+ """Defines a security scheme that can be used by the operations.
17
+
18
+ Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query
19
+ parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, client credentials
20
+ and authorization code) as defined in :rfc`6749`, and
21
+ `OpenID Connect Discovery <https://tools.ietf.org/html/draft-ietf-oauth-discovery-06>`_.
22
+
23
+ Please note that as of 2020, the implicit flow is about to be deprecated by
24
+ `OAuth 2.0 Security Best Current Practice <https://tools.ietf.org/html/draft-ietf-oauth-security-topics>`_.
25
+ Recommended for most use case is Authorization Code Grant flow with PKCE.
26
+ """
27
+
28
+ type: Literal["apiKey", "http", "mutualTLS", "oauth2", "openIdConnect"]
29
+ """**REQUIRED**. The type of the security scheme."""
30
+
31
+ description: str | None = None
32
+ """A description for security scheme.
33
+
34
+ `CommonMark syntax <https://spec.commonmark.org/>`_ MAY be used for rich text representation.
35
+ """
36
+
37
+ name: str | None = None
38
+ """
39
+ **REQUIRED** for ``apiKey``. The name of the header, query or cookie parameter to be used.
40
+ """
41
+
42
+ security_scheme_in: Literal["query", "header", "cookie"] | None = None
43
+ """
44
+ **REQUIRED** for ``apiKey``. The location of the API key.
45
+ """
46
+
47
+ scheme: str | None = None
48
+ """
49
+ **REQUIRED** for ``http``. The name of the HTTP Authorization scheme to be used in the
50
+ authorization header as defined in :rfc:`7235`.
51
+
52
+ The values used SHOULD be registered in the
53
+ `IANA Authentication Scheme registry <https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml>`_
54
+ """
55
+
56
+ bearer_format: str | None = None
57
+ """A hint to the client to identify how the bearer token is formatted.
58
+
59
+ Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation
60
+ purposes.
61
+ """
62
+
63
+ flows: OAuthFlows | None = None
64
+ """**REQUIRED** for ``oauth2``. An object containing configuration information for the flow types supported."""
65
+
66
+ open_id_connect_url: str | None = None
67
+ """**REQUIRED** for ``openIdConnect``. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in
68
+ the form of a URL. The OpenID Connect standard requires the use of TLS.
69
+ """
@@ -0,0 +1,34 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from .base import BaseSchemaObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .server_variable import ServerVariable
10
+
11
+ __all__ = ("Server",)
12
+
13
+
14
+ @dataclass
15
+ class Server(BaseSchemaObject):
16
+ """An object representing a Server."""
17
+
18
+ url: str
19
+ """
20
+ **REQUIRED**. A URL to the target host.
21
+
22
+ This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the
23
+ location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in
24
+ ``{brackets}``.
25
+ """
26
+
27
+ description: str | None = None
28
+ """An optional string describing the host designated by the URL.
29
+
30
+ `CommonMark syntax <https://spec.commonmark.org/>`_ MAY be used for rich text representation.
31
+ """
32
+
33
+ variables: dict[str, ServerVariable] | None = None
34
+ """A map between a variable name and its value. The value is used for substitution in the server's URL template."""
@@ -0,0 +1,32 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+
5
+ from .base import BaseSchemaObject
6
+
7
+ __all__ = ("ServerVariable",)
8
+
9
+
10
+ @dataclass
11
+ class ServerVariable(BaseSchemaObject):
12
+ """An object representing a Server Variable for server URL template substitution."""
13
+
14
+ default: str
15
+ """**REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_
16
+ supplied. Note this behavior is different than the
17
+ `Schema Object's <https://spec.openapis.org/oas/v3.1.0#schemaObject>`_ treatment of default values, because in those
18
+ cases parameter values are optional. If the `enum <https://spec.openapis.org/oas/v3.1.0#serverVariableEnum>`_ is
19
+ defined, the value MUST exist in the enum's values.
20
+ """
21
+
22
+ enum: list[str] | None = None
23
+ """An enumeration of string values to be used if the substitution options are from a limited set.
24
+
25
+ The array SHOULD NOT be empty.
26
+ """
27
+
28
+ description: str | None = None
29
+ """An optional description for the server variable.
30
+
31
+ `CommonMark syntax <https://spec.commonmark.org/>`_ MAY be used for rich text representation.
32
+ """
@@ -0,0 +1,32 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from .base import BaseSchemaObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .external_documentation import ExternalDocumentation
10
+
11
+ __all__ = ("Tag",)
12
+
13
+
14
+ @dataclass
15
+ class Tag(BaseSchemaObject):
16
+ """Adds metadata to a single tag that is used by the
17
+ `Operation Object <https://spec.openapis.org/oas/v3.1.0#operationObject>`_.
18
+
19
+ It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
20
+ """
21
+
22
+ name: str
23
+ """**REQUIRED**. The name of the tag."""
24
+
25
+ description: str | None = None
26
+ """A short description for the tag.
27
+
28
+ `CommonMark syntax <https://spec.commonmark.org/>`_ MAY be used for rich text representation.
29
+ """
30
+
31
+ external_docs: ExternalDocumentation | None = None
32
+ """Additional external documentation for this tag."""
@@ -0,0 +1,44 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+
5
+ from .base import BaseSchemaObject
6
+
7
+ __all__ = ("XML",)
8
+
9
+
10
+ @dataclass()
11
+ class XML(BaseSchemaObject):
12
+ """A metadata object that allows for more fine-tuned XML model definitions.
13
+
14
+ When using arrays, XML element names are *not* inferred (for singular/plural forms) and the ``name`` property SHOULD
15
+ be used to add that information. See examples for expected behavior.
16
+ """
17
+
18
+ name: str | None = None
19
+ """
20
+ Replaces the name of the element/attribute used for the described schema property. When defined within ``items``, it
21
+ will affect the name of the individual XML elements within the list. When defined alongside ``type`` being ``array``
22
+ (outside the ``items``), it will affect the wrapping element and only if ``wrapped`` is ``True``. If ``wrapped`` is
23
+ ``False``, it will be ignored.
24
+ """
25
+
26
+ namespace: str | None = None
27
+ """The URI of the namespace definition. Value MUST be in the form of an absolute URI."""
28
+
29
+ prefix: str | None = None
30
+ """The prefix to be used for the
31
+ `xmlName <https://spec.openapis.org/oas/v3.1.0#xmlName>`_
32
+ """
33
+
34
+ attribute: bool = False
35
+ """Declares whether the property definition translates to an attribute instead of an element. Default value is
36
+ ``False``.
37
+ """
38
+
39
+ wrapped: bool = False
40
+ """
41
+ MAY be used only for an array definition. Signifies whether the array is wrapped (for example,
42
+ ``<books><book/><book/></books>``) or unwrapped (``<book/><book/>``). Default value is ``False``. The definition
43
+ takes effect only when defined alongside ``type`` being ``array`` (outside the ``items``).
44
+ """