gws.base.ows.client.provider¶
Base OWS service provider.
Source code: gws.base.ows.client.provider
Module Contents¶
- class gws.base.ows.client.provider.AuthorizationConfig(*args, **kwargs)¶
Bases:
gws.ConfigCredentials for accessing the service.
- class gws.base.ows.client.provider.Config(*args, **kwargs)¶
Bases:
gws.ConfigOWS provider configuration.
- authorization: AuthorizationConfig | None¶
Service authorization options.
- capsCacheMaxAge: gws.Duration = '1d'¶
How long a downloaded capabilities document is cached.
- forceCrs: gws.CrsName | None¶
Use this CRS for requests.
- operations: list[OperationConfig] | None¶
Override operations reported in capabilities.
- class gws.base.ows.client.provider.Object¶
Bases:
gws.OwsServiceProviderBase OWS service provider.
Holds the service URL, version, operations and source layers of a remote OWS service, and prepares request arguments for its operations. Provides subclasses with capabilities download and caching, merging of configured and reported operations and format selection. Protocol-specific subclasses set
protocoland parse the capabilities.- cache_hash()¶
Compute a hash of the provider settings, used to build cache keys.
- Returns:
A hash of the URL, the forced CRS and the axis order setting.
- configure()¶
Configuration hook.
Called when the node is initialized. Raising an exception here aborts the creation of the node.
- configure_operations(operations_from_caps)¶
Set up the provider operations.
Operations from the configuration replace those from the capabilities with the same verb; attributes missing in the configuration are taken from the capabilities. A preferred format is then chosen for each operation: PNG or JPEG for image requests, GML3, GML or XML for others.
- Parameters:
operations_from_caps – Operations read from the capabilities.
- get_capabilities()¶
Download the capabilities document of the service.
The document is cached for
capsCacheMaxAge.- Returns:
The capabilities XML text.
- Raises:
gws.ExternalServiceError – If the request fails.
- get_operation(verb, method=None)¶
Find an operation by its verb.
- Parameters:
verb – Request type.
method – Request method. For
POST, the operation must have a POST URL, otherwise a GET URL.
- Returns:
The operation, or
Noneif the service does not support it.
- prepare_operation(op: gws.OwsOperation, method: gws.RequestMethod = None, params=None) gws.base.ows.client.request.Args¶
Prepare the request arguments for an operation.
For GET requests, the operation parameters are included. Parameter names are upper-cased and checked against the operation’s allowed values. Adds a basic
Authorizationheader if configured.- Parameters:
op – Operation.
method – Request method,
GETby default.params – Request parameters.
- Returns:
Request arguments, to be passed to
request.get.- Raises:
gws.Error – If a parameter value is not allowed by the operation.
- class gws.base.ows.client.provider.OperationConfig(*args, **kwargs)¶
Bases:
gws.ConfigOWS operation that overrides or adds to those in the service capabilities.
- params: dict | None¶
Extra parameters added to GET requests for this operation.
- verb: gws.OwsVerb¶
OWS request type.