magpie.owsrequest¶
The OWSRequest is based on pywps code:
https://github.com/geopython/pywps/tree/pywps-3.2/pywps/Parser
https://github.com/geopython/pywps/blob/master/pywps/app/WPSRequest.py
Attributes¶
Classes¶
Basically a case-insensitive query string parser. |
|
Functions¶
|
Obtains the value of |
|
Retrieves |
|
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when |
|
|
|
Retrieve the appropriate |
Module Contents¶
- magpie.owsrequest.get_multiformat_body(request: pyramid.request.Request, key: magpie.typedefs.Str, default: Any | None = None) Any[source]¶
Obtains the value of
keyelement from the request body according to specified Content-Type header.See also
get_multiformat_body_checked()get_permission_multiformat_body_checked()get_value_multiformat_body_checked()
- magpie.owsrequest.get_header(header_name: magpie.typedefs.Str, header_container: magpie.typedefs.AnyHeadersType, default: magpie.typedefs.Str | None, magpie.typedefs.Str | List[magpie.typedefs.Str] | None, bool = None, split: magpie.typedefs.Str | List[magpie.typedefs.Str] | None = None, multi: bool = False, pop: bool = False) magpie.typedefs.Str | List[magpie.typedefs.Str] | None[source]¶
Retrieves
header_nameby fuzzy match (independently of upper/lower-case and underscore/dash) from various framework implementations ofHeaders.If
splitis specified, the matchedheader_nameis first split with it and the first item is returned. This allows to parse complex headers (e.g.:text/plain; charset=UTF-8totext/plainwithsplit=';').- Parameters:
header_name – Header to find.
header_container – Where to look for header_name.
default – Value to returned if header_container is invalid or header_name could not be found.
split – Character(s) to use to split the found header_name.
multi – Return extracted header as array of multiple values or return a single value on fist match.
pop – Remove the header from the container if found.
- Returns:
Found header value(s) if applicable.
- magpie.owsrequest.get_logger(name: magpie.typedefs.Str, level: int | None = None, force_stdout: bool = None, message_format: magpie.typedefs.Str | None = None, datetime_format: magpie.typedefs.Str | None = None) logging.Logger[source]¶
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is
logging.NOTSET.
- magpie.owsrequest.ows_parser_factory(request: pyramid.request.Request) OWSParser[source]¶
Retrieve the appropriate
OWSParserparser using theContent-Typeheader.If the
Content-Typeheader is missing ortext/plain, and the request has a body, try to parse the body as JSON and set the content-type toapplication/jsonif successful.Handle XML-like
Content-Typeheaders such asapplication/x-www-form-urlencodedwhenever applicable.Otherwise, use the basic
OWSGetParserorOWSPostParseraccording to the presence of a body. These provide minimal parsing to handle most typical OGC Web Services (OWS) request parameters.
- class magpie.owsrequest.OWSParser(request)[source]¶
Bases:
object- parse(param_list)[source]¶
Parses the initialized
requestto populateparamsretrieved from the parser.Once this method has been called, all expected parameters are guaranteed to exist within :attr`params`. Missing query parameters from the
requestwill be set toNone. All query parameter names will be normalized to lower characters for easier retrieval.- Parameters:
param_list – all known query parameters to the service.
- class magpie.owsrequest.OWSGetParser(request)[source]¶
Bases:
OWSParserBasically a case-insensitive query string parser.