weaver.wps.utils
¶
Module Contents¶
-
weaver.wps.utils.
_get_settings_or_wps_config
(container: weaver.typedefs.AnySettingsContainer, weaver_setting_name: str, config_setting_section: str, config_setting_name: str, default_not_found: str, message_not_found: str) → str[source]¶
-
weaver.wps.utils.
get_wps_path
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the WPS path (without hostname).
Searches directly in settings, then weaver.wps_cfg file, or finally, uses the default values if not found.
-
weaver.wps.utils.
get_wps_url
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the full WPS URL (hostname + WPS path)
Searches directly in settings, then weaver.wps_cfg file, or finally, uses the default values if not found.
-
weaver.wps.utils.
get_wps_output_dir
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the WPS output directory path where to write XML and result files. Searches directly in settings, then weaver.wps_cfg file, or finally, uses the default values if not found.
-
weaver.wps.utils.
get_wps_output_path
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the WPS output path (without hostname) for staging XML status, logs and process outputs. Searches directly in settings, then weaver.wps_cfg file, or finally, uses the default values if not found.
-
weaver.wps.utils.
get_wps_output_url
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the WPS output URL that maps to WPS output directory path. Searches directly in settings, then weaver.wps_cfg file, or finally, uses the default values if not found.
-
weaver.wps.utils.
get_wps_local_status_location
(url_status_location: str, container: weaver.typedefs.AnySettingsContainer, must_exist: bool = True) → Optional[str][source]¶ Attempts to retrieve the local XML file path corresponding to the WPS status location as URL.
- Parameters
url_status_location – URL reference pointing to some WPS status location XML.
container – any settings container to map configured local paths.
must_exist – return only existing path if enabled, otherwise return the parsed value without validation.
- Returns
found local file path if it exists,
None
otherwise.
-
weaver.wps.utils.
check_wps_status
(location: Optional[str] = None, response: Optional[XML] = None, sleep_secs: int = 2, verify: bool = True, settings: Optional[AnySettingsContainer] = None) → owslib.wps.WPSExecution[source]¶ Run
owslib.wps.WPSExecution.checkStatus()
with additional exception handling.- Parameters
location – job URL or file path where to look for job status.
response – WPS response document of job status.
sleep_secs – number of seconds to sleep before returning control to the caller.
verify – Flag to enable SSL verification.
settings – Application settings to retrieve any additional request parameters as applicable.
- Returns
OWSLib.wps.WPSExecution object.
-
weaver.wps.utils.
load_pywps_config
(container: weaver.typedefs.AnySettingsContainer, config: Optional[Union[str, Dict[str, str]]] = None) → configparser.ConfigParser[source]¶ Loads and updates the PyWPS configuration using Weaver settings.
-
weaver.wps.utils.
set_wps_language
(wps: owslib.wps.WebProcessingService, accept_language: Optional[str] = None, request: Optional[Request] = None) → None[source]¶ Set the
language
property on theWebProcessingService
object.Given the Accept-Language header value, match the best language to the supported languages.
By default, and if no match is found, the
WebProcessingService.language
property is set to None.https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language (q-factor weighting is ignored, only order is considered)
- Parameters
wps – process for which to set the language header if it is accepted
accept_language (str) – the value of the Accept-Language header
request – request from which to extract Accept-Language header if not provided directly