weaver.wps_restapi.api

Module Contents

weaver.wps_restapi.api.Conformance[source]
weaver.wps_restapi.api.LOGGER[source]
weaver.wps_restapi.api.get_conformance(category: weaver.wps_restapi.constants.AnyConformanceCategory | None, settings: weaver.typedefs.SettingsType) Conformance[source]

Obtain the conformance references.

See also

weaver.wps_restapi.api.api_frontpage(request: weaver.typedefs.SettingsType) weaver.typedefs.JSON[source]

Frontpage of Weaver.

weaver.wps_restapi.api.api_frontpage_body(settings: weaver.typedefs.SettingsType) weaver.typedefs.JSON[source]

Generates the JSON body describing the Weaver API and documentation references.

weaver.wps_restapi.api.api_versions(request: pyramid.request.Request) pyramid.httpexceptions.HTTPException[source]

Weaver versions information.

weaver.wps_restapi.api.api_conformance(request: pyramid.request.Request) pyramid.httpexceptions.HTTPException[source]

Weaver specification conformance information.

weaver.wps_restapi.api.get_openapi_json(http_scheme: str = 'http', http_host: str = 'localhost', base_url: str | None = None, use_refs: bool = True, use_docstring_summary: bool = True, container: weaver.typedefs.AnySettingsContainer | None = None) weaver.typedefs.OpenAPISpecification[source]

Obtains the JSON schema of Weaver OpenAPI from request and response views schemas.

Parameters:
  • http_scheme – Protocol scheme to use for building the API base if not provided by base URL parameter.

  • http_host – Hostname to use for building the API base if not provided by base URL parameter.

  • base_url – Explicit base URL to employ of as API base instead of HTTP scheme/host parameters.

  • use_refs – Generate schemas with $ref definitions or expand every schema content.

  • use_docstring_summary – Extra function docstring to auto-generate the summary field of responses.

  • container – Container with the pyramid registry and settings to retrieve further metadata details to be added to the OpenAPI.

weaver.wps_restapi.api.openapi_json_cached(*args: Any, **kwargs: Any) weaver.typedefs.OpenAPISpecification[source]
weaver.wps_restapi.api.openapi_json(request: pyramid.request.Request) pyramid.httpexceptions.HTTPException[source]

Weaver OpenAPI schema definitions.

weaver.wps_restapi.api.swagger_ui_cached(request: pyramid.request.Request) weaver.typedefs.AnyResponseType[source]
weaver.wps_restapi.api.api_swagger_ui(request: pyramid.request.Request) weaver.typedefs.AnyResponseType[source]

Weaver OpenAPI schema definitions rendering using Swagger-UI viewer.

weaver.wps_restapi.api.redoc_ui_cached(request)[source]
weaver.wps_restapi.api.api_redoc_ui(request)[source]

Weaver OpenAPI schema definitions rendering using Redoc viewer.

weaver.wps_restapi.api.get_request_info(request: pyramid.request.Request, detail: str | None = None) weaver.typedefs.JSON[source]

Provided additional response details based on the request and execution stack on failure.

weaver.wps_restapi.api.ows_json_format(function: weaver.typedefs.ViewHandler) Callable[[pyramid.httpexceptions.HTTPException, pyramid.request.Request], pyramid.httpexceptions.HTTPException][source]

Decorator that adds additional detail in the response’s JSON body if this is the returned content-type.

weaver.wps_restapi.api.not_found_or_method_not_allowed(request: pyramid.request.Request) pyramid.httpexceptions.HTTPException[source]

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.

weaver.wps_restapi.api.unauthorized_or_forbidden(request: pyramid.request.Request) pyramid.httpexceptions.HTTPException[source]

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.

weaver.wps_restapi.api.redirect_view(request: pyramid.request.Request) pyramid.httpexceptions.HTTPException[source]

Handles redirection of API core requests to the OGC API - Processes prefixed endpoints.

When weaver.wps_restapi_path is set to another endpoint than the default, the core API endpoints used to report documentation details such as the 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 OGC API - Processes endpoints, but also other locations such as for the WPS and 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.

weaver.wps_restapi.api.includeme(config: pyramid.config.Configurator) None[source]