weaver.execute
Module Contents
- class weaver.execute.ExecuteMode[source]
Constants container that provides similar functionalities to
ExtendedEnum
without explicit Enum membership.
- class weaver.execute.ExecuteControlOption[source]
Constants container that provides similar functionalities to
ExtendedEnum
without explicit Enum membership.
- class weaver.execute.ExecuteReturnPreference[source]
Constants container that provides similar functionalities to
ExtendedEnum
without explicit Enum membership.
- class weaver.execute.ExecuteResponse[source]
Constants container that provides similar functionalities to
ExtendedEnum
without explicit Enum membership.
- class weaver.execute.ExecuteTransmissionMode[source]
Constants container that provides similar functionalities to
ExtendedEnum
without explicit Enum membership.
- class weaver.execute.ExecuteCollectionFormat[source]
Constants container that provides similar functionalities to
ExtendedEnum
without explicit Enum membership.
- weaver.execute.parse_prefer_header_return(headers: weaver.typedefs.AnyHeadersContainer) AnyExecuteReturnPreference | None [source]
Get the return preference if specified.
- weaver.execute.parse_prefer_header_execute_mode(header_container: weaver.typedefs.AnyHeadersContainer, supported_modes: List[AnyExecuteControlOption] | None = None, wait_max: int = 10) Tuple[AnyExecuteMode, int | None, weaver.typedefs.HeadersType] [source]
Obtain execution preference if provided in request headers.
See also
OGC API - Processes: Core, Execution mode < https://docs.ogc.org/is/18-062r2/18-062r2.html#sc_execution_mode>`_. This defines all conditions how to handle
Prefer
against applicable Process description.RFC 7240#section-4.1 HTTP Prefer header
respond-async
See also
If
Prefer
format is valid, but server decides it cannot be respected, it can be transparently ignored (RFC 7240#section-2). The server must respond withPreference-Applied
indicating preserved preferences it decided to respect.- Parameters:
header_container – Request headers to retrieve preference, if any available.
supported_modes – Execute modes that are permitted for the operation that received the
Prefer
header. Resolved mode will respect this constraint following specification requirements of OGC API - Processes.wait_max – Maximum wait time enforced by the server. If requested wait time is greater,
wait
preference will not be applied and will fall back to asynchronous response.
- Returns:
Tuple of resolved execution mode, wait time if specified, and header of applied preferences if possible. Maximum wait time indicates duration until synchronous response should fall back to asynchronous response.
- Raises:
HTTPBadRequest – If contents of
Prefer
are not valid.
- weaver.execute.update_preference_applied_return_header(job: weaver.datatype.Job, request_headers: weaver.typedefs.AnyHeadersContainer | None, response_headers: weaver.typedefs.AnyHeadersContainer | None) weaver.typedefs.AnyHeadersContainer [source]
Updates the
Preference-Applied
header according to available information.- Parameters:
job – Job where the desired return preference has be resolved.
request_headers – Original request headers, to look for any
Prefer: return
.response_headers – Already generated response headers, to extend
Preference-Applied
header as needed.
- Returns:
Updated response headers with any resolved return preference.