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 Attributes ---------- .. autoapisummary:: magpie.owsrequest.LOGGER Classes ------- .. autoapisummary:: magpie.owsrequest.OWSParser magpie.owsrequest.OWSGetParser magpie.owsrequest.OWSPostParser magpie.owsrequest.MultiFormatParser Functions --------- .. autoapisummary:: magpie.owsrequest.ows_parser_factory Module Contents --------------- .. py:data:: LOGGER .. py: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. .. py:class:: OWSParser(request) Bases: :py:obj:`object` .. py:attribute:: request .. py:attribute:: params .. py:method:: parse(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. .. py:method:: _get_param_value(param) :abstractmethod: .. py:class:: OWSGetParser(request) Bases: :py:obj:`OWSParser` Basically a case-insensitive query string parser. .. py:attribute:: _params .. py:method:: _request_params() .. py:method:: _get_param_value(param) .. py:class:: OWSPostParser(request) Bases: :py:obj:`OWSParser` .. py:attribute:: document .. py:method:: _get_param_value(param) .. py:class:: MultiFormatParser(request) Bases: :py:obj:`OWSParser` .. py:method:: _get_param_value(param)