9.1.2.13. GeoHealthCheck.probe

9.1.2.13.1. Module Contents

9.1.2.13.1.1. Classes

Probe

Base class for specific implementations to run a Probe with Checks.

9.1.2.13.1.2. Attributes

LOGGER

GeoHealthCheck.probe.LOGGER
class GeoHealthCheck.probe.Probe

Bases: plugin.Plugin

Base class for specific implementations to run a Probe with Checks. Most Probes can be implemented using REQUEST_TEMPLATES parameterized via actualized PARAM_DEFS but specialized Probes may implement their own Requests and Checks, for example by “drilling down” through OWS services on an OGC OWS endpoint starting at the Capabilities level or for specific WWW:LINK-based REST APIs.

RESOURCE_TYPE = 'Not Applicable'

Type of GHC Resource e.g. ‘OGC:WMS’, default not applicable.

REQUEST_METHOD = 'GET'

HTTP request method capitalized, GET (default) or POST.

REQUEST_HEADERS

dict of optional HTTP request headers.

STANDARD_REQUEST_HEADERS

dict of HTTP headers to add to each HTTP request.

REQUEST_TEMPLATE = ''

Template in standard Python str.format(*args). The variables like {service} and {version} within a template are filled from actual values for parameters defined in PARAM_DEFS and substituted from values or constant values specified by user in GUI and stored in DB.

PARAM_DEFS

Parameter definitions mostly for REQUEST_TEMPLATE but potential other uses in specific Probe implementations. Format is dict where each key is a parameter name and the value a dict of: type, description, required, default, range (value range) and optional value item. If value specified, this value becomes fixed (non-editable) unless overridden in subclass.

CHECKS_AVAIL

Available Check (classes) for this Probe in dict format. Key is a Check class (string), values are optional (default {}). In the (constant) value ‘parameters’ and other attributes for Check.PARAM_DEFS can be specified, including default if this Check should be added to Probe on creation.

METADATA_CACHE

Cache for metadata, like capabilities documents or OWSLib Service instances. Saves doing multiple requests/responses. In particular for endpoints with 50+ Layers.

expand_params(resource)

Called after creation. Use to expand PARAM_DEFS, e.g. from Resource metadata like WMS Capabilities. See e.g. WmsGetMapV1 class. :param resource: :return: None

get_metadata(resource, version='any')

Get metadata, specific per Resource type. :param resource: :param version: :return: Metadata object

get_metadata_cached(resource, version='any')

Get metadata, specific per Resource type, get from cache if cached. :param resource: :param version: :return: Metadata object

init(resource, probe_vars)

Probe contains the actual Probe parameters (from Models/DB) for requests and a list of response Checks with their functions and parameters :param resource: :param probe_vars: :return: None

exit()
get_var_names()

Get all Plugin variable names as a dict

expand_check_vars(checks_avail)
get_checks_info_defaults()
get_checks_info()
get_plugin_vars()

Get all (uppercase) class variables of a class as a dict

log(text)
before_request()

Before running actual request to service

after_request()

After running actual request to service

get_request_headers()
perform_request()

Perform actual request to service

perform_get_request(url)

Perform actual HTTP GET request to service

perform_post_request(url_base, request_string)

Perform actual HTTP POST request to service

run_request()

Run actual request to service

run_checks()

Do the checks on the response from request

calc_result()

Calculate overall result from the Result object

static run(resource, probe_vars)

Class method to create and run a single Probe instance. Follows strict sequence of method calls. Each method can be overridden in subclass.