weaver.wps_restapi.api ====================== .. py:module:: weaver.wps_restapi.api Module Contents --------------- .. py:data:: Conformance .. py:data:: LOGGER .. py:function:: get_conformance(category: Optional[weaver.wps_restapi.constants.AnyConformanceCategory], settings: weaver.typedefs.SettingsType) -> Conformance Obtain the conformance references. .. seealso:: - https://github.com/opengeospatial/ogcapi-common/tree/master/collections - https://github.com/opengeospatial/ogcapi-processes/tree/master/core - https://github.com/opengeospatial/ogcapi-processes/tree/master/extensions/deploy_replace_undeploy - https://github.com/opengeospatial/ogcapi-processes/tree/master/extensions/workflows .. seealso:: - OGC API - Processes, Core document: https://docs.ogc.org/is/18-062r2/18-062r2.html - Best-Practices document: https://docs.ogc.org/bp/20-089r1.html .. py:function:: api_frontpage(request: weaver.typedefs.SettingsType) -> weaver.typedefs.JSON Frontpage of Weaver. .. py:function:: api_frontpage_body(settings: weaver.typedefs.SettingsType) -> weaver.typedefs.JSON Generates the JSON body describing the Weaver API and documentation references. .. py:function:: api_versions(request: pyramid.request.Request) -> pyramid.httpexceptions.HTTPException Weaver versions information. .. py:function:: api_conformance(request: pyramid.request.Request) -> pyramid.httpexceptions.HTTPException Weaver specification conformance information. .. py:function:: get_openapi_json(http_scheme: str = 'http', http_host: str = 'localhost', base_url: Optional[str] = None, use_refs: bool = True, use_docstring_summary: bool = True, container: Optional[weaver.typedefs.AnySettingsContainer] = None) -> weaver.typedefs.OpenAPISpecification Obtains the JSON schema of Weaver OpenAPI from request and response views schemas. :param http_scheme: Protocol scheme to use for building the API base if not provided by base URL parameter. :param http_host: Hostname to use for building the API base if not provided by base URL parameter. :param base_url: Explicit base URL to employ of as API base instead of HTTP scheme/host parameters. :param use_refs: Generate schemas with ``$ref`` definitions or expand every schema content. :param use_docstring_summary: Extra function docstring to auto-generate the summary field of responses. :param container: Container with the :mod:`pyramid` registry and settings to retrieve further metadata details to be added to the :term:`OpenAPI`. .. seealso:: - :mod:`weaver.wps_restapi.swagger_definitions` .. py:function:: openapi_json_cached(*args: Any, **kwargs: Any) -> weaver.typedefs.OpenAPISpecification .. py:function:: openapi_json(request: pyramid.request.Request) -> pyramid.httpexceptions.HTTPException Weaver OpenAPI schema definitions. .. py:function:: swagger_ui_cached(request: pyramid.request.Request) -> weaver.typedefs.AnyResponseType .. py:function:: api_swagger_ui(request: pyramid.request.Request) -> weaver.typedefs.AnyResponseType Weaver OpenAPI schema definitions rendering using Swagger-UI viewer. .. py:function:: redoc_ui_cached(request) .. py:function:: api_redoc_ui(request) Weaver OpenAPI schema definitions rendering using Redoc viewer. .. py:function:: get_request_info(request: pyramid.request.Request, detail: Optional[str] = None) -> weaver.typedefs.JSON Provided additional response details based on the request and execution stack on failure. .. py:function:: ows_json_format(function: weaver.typedefs.ViewHandler) -> Callable[[pyramid.httpexceptions.HTTPException, pyramid.request.Request], pyramid.httpexceptions.HTTPException] Decorator that adds additional detail in the response's JSON body if this is the returned content-type. .. py:function:: not_found_or_method_not_allowed(request: pyramid.request.Request) -> pyramid.httpexceptions.HTTPException Overrides the default is HTTPNotFound [404] by appropriate HTTPMethodNotAllowed [405] when applicable. Not found response can correspond to underlying process operation not finding a required item, or a completely unknown route (path did not match any existing API definition). Method not allowed is more specific to the case where the path matches an existing API route, but the specific request method (GET, POST, etc.) is not allowed on this path. Without this fix, both situations return [404] regardless. .. py:function:: unauthorized_or_forbidden(request: pyramid.request.Request) -> pyramid.httpexceptions.HTTPException Overrides the default is HTTPForbidden [403] by appropriate HTTPUnauthorized [401] when applicable. Unauthorized response is for restricted user access according to credentials and/or authorization headers. Forbidden response is for operation refused by the underlying process operations. Without this fix, both situations return [403] regardless. .. seealso:: - https://www.restapitutorial.com/httpstatuscodes.html .. py:function:: redirect_view(request: pyramid.request.Request) -> pyramid.httpexceptions.HTTPException Handles redirection of :term:`API` core requests to the :term:`OGC API - Processes` prefixed endpoints. When ``weaver.wps_restapi_path`` is set to another endpoint than the default, the core :term:`API` endpoints used to report documentation details such as the :term:`OpenAPI` definition and the entrypoint page become available on both the prefixed and non-prefixed paths. This is required to provide details that are not *only* relevant for the :term:`OGC API - Processes` endpoints, but also other locations such as for the :term:`WPS` and :term:`Vault` requests. Because the `HTTP 302 Found` request emitted for redirection could "loose" the ``Accept`` header originally provided (or resolved from a format query), an ``f`` query parameter reflecting the desired format will be re-applied to ensure the redirection yields the intended ``Content-Type`` result. If none of the format specifier where provided, the default resolution will leave out the ``f`` query to let the destination URL resolved its own default ``Content-Type``. .. py:function:: includeme(config: pyramid.config.Configurator) -> None