:mod:`magpie.owsrequest` ======================== .. py:module:: magpie.owsrequest .. autoapi-nested-parse:: 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 Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: magpie.owsrequest.OWSParser magpie.owsrequest.OWSGetParser magpie.owsrequest.OWSPostParser magpie.owsrequest.MultiFormatParser Functions ~~~~~~~~~ .. autoapisummary:: magpie.owsrequest.ows_parser_factory magpie.owsrequest.lxml_strip_ns .. data:: LOGGER .. function:: ows_parser_factory(request: pyramid.request.Request) -> OWSParser Retrieve the appropriate :class:`OWSParser` parser using the ``Content-Type`` header. If the ``Content-Type`` header is missing or ``text/plain``, and the request has a body, try to parse the body as JSON and set the content-type to ``application/json`` if successful. Handle XML-like ``Content-Type`` headers such as ``application/x-www-form-urlencoded`` whenever applicable. Otherwise, use the basic :class:`OWSGetParser` or :class:`OWSPostParser` according to the presence of a body. These provide minimal parsing to handle most typical `OGC Web Services` (:term:`OWS`) request parameters. .. class:: OWSParser(request) Bases: :class:`object` .. method:: parse(self, param_list) Parses the initialized :attr:`request` to populate :attr:`params` retrieved from the parser. Once this method has been called, all expected parameters are guaranteed to exist within :attr`params`. Missing query parameters from the :attr:`request` will be set to ``None``. All query parameter names will be normalized to *lower* characters for easier retrieval. :param param_list: all known query parameters to the service. .. method:: _get_param_value(self, param) :abstractmethod: .. class:: OWSGetParser(request) Bases: :class:`magpie.owsrequest.OWSParser` Basically a case-insensitive query string parser. .. method:: _request_params(self) .. method:: _get_param_value(self, param) .. function:: lxml_strip_ns(tree) .. class:: OWSPostParser(request) Bases: :class:`magpie.owsrequest.OWSParser` .. method:: _get_param_value(self, param) .. class:: MultiFormatParser(request) Bases: :class:`magpie.owsrequest.OWSParser` .. method:: _get_param_value(self, param)