api.v2 package¶
The second version of the API.
Submodules¶
api.v2.apps module¶
App configuration.
- class api.v2.apps.ApiV2Config(app_name, app_module)[source]¶
Bases:
django.apps.AppConfig
Configuration for the api.v2 app.
api.v2.auth module¶
Authentication & authorization utilities.
- class api.v2.auth.ApiKeyAuthentication[source]¶
Bases:
rest_framework.authentication.TokenAuthentication
API key authentication class.
- keyword = 'X-API-Key'¶
- model¶
alias of
users.models.ApiKey
api.v2.mixins module¶
API mixin classes.
api.v2.negotiation module¶
Content negotiation utilities.
api.v2.pagination module¶
Pagination utilities.
- class api.v2.pagination.DummyPagination[source]¶
Bases:
rest_framework.pagination.BasePagination
Dummy pagination class that simply wraps results.
api.v2.schema module¶
Schema utilities.
- class api.v2.schema.OpenAPISchema(tags=None, operation_id_base=None, component_name=None)[source]¶
Bases:
rest_framework.schemas.openapi.AutoSchema
Custom OpenAPI schema class.
- header_regex = re.compile('^\\* [a-z]+:')¶
- variable_regex = re.compile('{([^}]+)}')¶
- get_path_parameters(path, method)[source]¶
Return a list of parameters from templated path variables.
api.v2.urls module¶
The URLconf of the api.v2 app.
- api.v2.urls.app_name = 'v2'¶
The URL namespace of the api.v2 app.
- api.v2.urls.urlpatterns = [<URLResolver <URLPattern list> (None:None) ''>, <URLPattern 'profile'>, <URLPattern 'openapi.json' [name='schema']>, <URLPattern 'docs/' [name='rapidoc']>, <URLPattern 'redoc/' [name='redoc']>, <URLPattern 'swagger/' [name='swagger']>]¶
The URL patterns of the api.v2 app.
api.v2.views module¶
The custom views of the api.v2 app.
- api.v2.views.openapi(self, request, *args, **kwargs)¶
The generated OpenAPI schema as a view.
- api.v2.views.redoc_redirect(request)[source]¶
Redirect to the ReDoc demo with our schema.
Deprecated since version 0.8.2: Removed in favor of
rapidoc()
.- Parameters
request (
HttpRequest
) –- Return type
- api.v2.views.swagger_redirect(request)[source]¶
Redirect to the Swagger generator with our schema.
Deprecated since version 0.8.2: Removed in favor of
rapidoc()
.- Parameters
request (
HttpRequest
) –- Return type
- api.v2.views.rapidoc(request)¶
View that serves the RapiDoc documentation of the site.
- Parameters
request (
HttpRequest
) – The original request.- Return type
- Returns
A response with the rendered
rapidoc.html
template.