weaver.owsexceptions

See also: https://github.com/geopython/pywps/blob/master/pywps/exceptions.py

Module Contents

exception weaver.owsexceptions.OWSException(detail=None, value=None, **kw)[source]

Represents a WSGI response.

If no arguments are passed, creates a Response that uses a variety of defaults. The defaults may be changed by sub-classing the Response. See the sub-classing notes.

Variables
  • body (bytes or text_type) – If body is a text_type, then it will be encoded using either charset when provided or default_encoding when charset is not provided if the content_type allows for a charset. This argument is mutually exclusive with app_iter.

  • status (int or str) – Either an int or a string that is an integer followed by the status text. If it is an integer, it will be converted to a proper status that also includes the status text. Any existing status text will be kept. Non-standard values are allowed.

  • headerlist (list) – A list of HTTP headers for the response.

  • app_iter (iterable) – An iterator that is used as the body of the response. Should conform to the WSGI requirements and should provide bytes. This argument is mutually exclusive with body.

  • content_type (str or None) – Sets the Content-Type header. If no content_type is provided, and there is no headerlist, the default_content_type will be automatically set. If headerlist is provided then this value is ignored.

  • conditional_response (bool) – Used to change the behavior of the Response to check the original request for conditional response headers. See conditional_response_app() for more information.

  • charset (str or None) – Adds a charset Content-Type parameter. If no charset is provided and the Content-Type is text, then the default_charset will automatically be added. Currently the only Content-Type’s that allow for a charset are defined to be text/*, application/xml, and */*+xml. Any other Content-Type’s will not have a charset added. If a headerlist is provided this value is ignored.

All other response attributes may be set on the response by providing them as keyword arguments. A TypeError will be raised for any unexpected keywords.

Sub-classing notes:

  • The default_content_type is used as the default for the Content-Type header that is returned on the response. It is text/html.

  • The default_charset is used as the default character set to return on the Content-Type header, if the Content-Type allows for a charset parameter. Currently the only Content-Type’s that allow for a charset are defined to be: text/*, application/xml, and */*+xml. Any other Content-Type’s will not have a charset added.

  • The unicode_errors is set to strict, and access on a text will raise an error if it fails to decode the body.

  • default_conditional_response is set to False. This flag may be set to True so that all Response objects will attempt to check the original request for conditional response headers. See conditional_response_app() for more information.

  • default_body_encoding is set to ‘UTF-8’ by default. It exists to allow users to get/set the Response object using .text, even if no charset has been set for the Content-Type.

Initialize self. See help(type(self)) for accurate signature.

code = NoApplicableCode[source]
value[source]
locator = NoApplicableCode[source]
explanation = Unknown Error[source]
page_template[source]
exception[source]
static json_formatter(status: AnyStr, body: AnyStr, title: AnyStr, environ: SettingsType)[source]
prepare(self, environ)[source]
property wsgi_response(self)[source]
exception weaver.owsexceptions.OWSAccessForbidden(*args, **kwargs)[source]

Represents a WSGI response.

If no arguments are passed, creates a Response that uses a variety of defaults. The defaults may be changed by sub-classing the Response. See the sub-classing notes.

Variables
  • body (bytes or text_type) – If body is a text_type, then it will be encoded using either charset when provided or default_encoding when charset is not provided if the content_type allows for a charset. This argument is mutually exclusive with app_iter.

  • status (int or str) – Either an int or a string that is an integer followed by the status text. If it is an integer, it will be converted to a proper status that also includes the status text. Any existing status text will be kept. Non-standard values are allowed.

  • headerlist (list) – A list of HTTP headers for the response.

  • app_iter (iterable) – An iterator that is used as the body of the response. Should conform to the WSGI requirements and should provide bytes. This argument is mutually exclusive with body.

  • content_type (str or None) – Sets the Content-Type header. If no content_type is provided, and there is no headerlist, the default_content_type will be automatically set. If headerlist is provided then this value is ignored.

  • conditional_response (bool) – Used to change the behavior of the Response to check the original request for conditional response headers. See conditional_response_app() for more information.

  • charset (str or None) – Adds a charset Content-Type parameter. If no charset is provided and the Content-Type is text, then the default_charset will automatically be added. Currently the only Content-Type’s that allow for a charset are defined to be text/*, application/xml, and */*+xml. Any other Content-Type’s will not have a charset added. If a headerlist is provided this value is ignored.

All other response attributes may be set on the response by providing them as keyword arguments. A TypeError will be raised for any unexpected keywords.

Sub-classing notes:

  • The default_content_type is used as the default for the Content-Type header that is returned on the response. It is text/html.

  • The default_charset is used as the default character set to return on the Content-Type header, if the Content-Type allows for a charset parameter. Currently the only Content-Type’s that allow for a charset are defined to be: text/*, application/xml, and */*+xml. Any other Content-Type’s will not have a charset added.

  • The unicode_errors is set to strict, and access on a text will raise an error if it fails to decode the body.

  • default_conditional_response is set to False. This flag may be set to True so that all Response objects will attempt to check the original request for conditional response headers. See conditional_response_app() for more information.

  • default_body_encoding is set to ‘UTF-8’ by default. It exists to allow users to get/set the Response object using .text, even if no charset has been set for the Content-Type.

Initialize self. See help(type(self)) for accurate signature.

locator = AccessUnauthorized[source]
explanation = Access to this service is unauthorized.[source]
exception weaver.owsexceptions.OWSNotFound(*args, **kwargs)[source]

Represents a WSGI response.

If no arguments are passed, creates a Response that uses a variety of defaults. The defaults may be changed by sub-classing the Response. See the sub-classing notes.

Variables
  • body (bytes or text_type) – If body is a text_type, then it will be encoded using either charset when provided or default_encoding when charset is not provided if the content_type allows for a charset. This argument is mutually exclusive with app_iter.

  • status (int or str) – Either an int or a string that is an integer followed by the status text. If it is an integer, it will be converted to a proper status that also includes the status text. Any existing status text will be kept. Non-standard values are allowed.

  • headerlist (list) – A list of HTTP headers for the response.

  • app_iter (iterable) – An iterator that is used as the body of the response. Should conform to the WSGI requirements and should provide bytes. This argument is mutually exclusive with body.

  • content_type (str or None) – Sets the Content-Type header. If no content_type is provided, and there is no headerlist, the default_content_type will be automatically set. If headerlist is provided then this value is ignored.

  • conditional_response (bool) – Used to change the behavior of the Response to check the original request for conditional response headers. See conditional_response_app() for more information.

  • charset (str or None) – Adds a charset Content-Type parameter. If no charset is provided and the Content-Type is text, then the default_charset will automatically be added. Currently the only Content-Type’s that allow for a charset are defined to be text/*, application/xml, and */*+xml. Any other Content-Type’s will not have a charset added. If a headerlist is provided this value is ignored.

All other response attributes may be set on the response by providing them as keyword arguments. A TypeError will be raised for any unexpected keywords.

Sub-classing notes:

  • The default_content_type is used as the default for the Content-Type header that is returned on the response. It is text/html.

  • The default_charset is used as the default character set to return on the Content-Type header, if the Content-Type allows for a charset parameter. Currently the only Content-Type’s that allow for a charset are defined to be: text/*, application/xml, and */*+xml. Any other Content-Type’s will not have a charset added.

  • The unicode_errors is set to strict, and access on a text will raise an error if it fails to decode the body.

  • default_conditional_response is set to False. This flag may be set to True so that all Response objects will attempt to check the original request for conditional response headers. See conditional_response_app() for more information.

  • default_body_encoding is set to ‘UTF-8’ by default. It exists to allow users to get/set the Response object using .text, even if no charset has been set for the Content-Type.

Initialize self. See help(type(self)) for accurate signature.

locator = NotFound[source]
explanation = This resource does not exist.[source]
exception weaver.owsexceptions.OWSNotAcceptable(*args, **kwargs)[source]

Represents a WSGI response.

If no arguments are passed, creates a Response that uses a variety of defaults. The defaults may be changed by sub-classing the Response. See the sub-classing notes.

Variables
  • body (bytes or text_type) – If body is a text_type, then it will be encoded using either charset when provided or default_encoding when charset is not provided if the content_type allows for a charset. This argument is mutually exclusive with app_iter.

  • status (int or str) – Either an int or a string that is an integer followed by the status text. If it is an integer, it will be converted to a proper status that also includes the status text. Any existing status text will be kept. Non-standard values are allowed.

  • headerlist (list) – A list of HTTP headers for the response.

  • app_iter (iterable) – An iterator that is used as the body of the response. Should conform to the WSGI requirements and should provide bytes. This argument is mutually exclusive with body.

  • content_type (str or None) – Sets the Content-Type header. If no content_type is provided, and there is no headerlist, the default_content_type will be automatically set. If headerlist is provided then this value is ignored.

  • conditional_response (bool) – Used to change the behavior of the Response to check the original request for conditional response headers. See conditional_response_app() for more information.

  • charset (str or None) – Adds a charset Content-Type parameter. If no charset is provided and the Content-Type is text, then the default_charset will automatically be added. Currently the only Content-Type’s that allow for a charset are defined to be text/*, application/xml, and */*+xml. Any other Content-Type’s will not have a charset added. If a headerlist is provided this value is ignored.

All other response attributes may be set on the response by providing them as keyword arguments. A TypeError will be raised for any unexpected keywords.

Sub-classing notes:

  • The default_content_type is used as the default for the Content-Type header that is returned on the response. It is text/html.

  • The default_charset is used as the default character set to return on the Content-Type header, if the Content-Type allows for a charset parameter. Currently the only Content-Type’s that allow for a charset are defined to be: text/*, application/xml, and */*+xml. Any other Content-Type’s will not have a charset added.

  • The unicode_errors is set to strict, and access on a text will raise an error if it fails to decode the body.

  • default_conditional_response is set to False. This flag may be set to True so that all Response objects will attempt to check the original request for conditional response headers. See conditional_response_app() for more information.

  • default_body_encoding is set to ‘UTF-8’ by default. It exists to allow users to get/set the Response object using .text, even if no charset has been set for the Content-Type.

Initialize self. See help(type(self)) for accurate signature.

locator = NotAcceptable[source]
explanation = Access to this service failed.[source]
exception weaver.owsexceptions.OWSNoApplicableCode(*args, **kwargs)[source]

WPS Bad Request Exception

Initialize self. See help(type(self)) for accurate signature.

code = NoApplicableCode[source]
locator =[source]
explanation = Parameter value is missing[source]
exception weaver.owsexceptions.OWSMissingParameterValue(*args, **kwargs)[source]

MissingParameterValue WPS Exception

Initialize self. See help(type(self)) for accurate signature.

code = MissingParameterValue[source]
locator =[source]
explanation = Parameter value is missing[source]
exception weaver.owsexceptions.OWSInvalidParameterValue(*args, **kwargs)[source]

InvalidParameterValue WPS Exception

Initialize self. See help(type(self)) for accurate signature.

code = InvalidParameterValue[source]
locator =[source]
explanation = Parameter value is not acceptable.[source]
exception weaver.owsexceptions.OWSNotImplemented(*args, **kwargs)[source]

Represents a WSGI response.

If no arguments are passed, creates a Response that uses a variety of defaults. The defaults may be changed by sub-classing the Response. See the sub-classing notes.

Variables
  • body (bytes or text_type) – If body is a text_type, then it will be encoded using either charset when provided or default_encoding when charset is not provided if the content_type allows for a charset. This argument is mutually exclusive with app_iter.

  • status (int or str) – Either an int or a string that is an integer followed by the status text. If it is an integer, it will be converted to a proper status that also includes the status text. Any existing status text will be kept. Non-standard values are allowed.

  • headerlist (list) – A list of HTTP headers for the response.

  • app_iter (iterable) – An iterator that is used as the body of the response. Should conform to the WSGI requirements and should provide bytes. This argument is mutually exclusive with body.

  • content_type (str or None) – Sets the Content-Type header. If no content_type is provided, and there is no headerlist, the default_content_type will be automatically set. If headerlist is provided then this value is ignored.

  • conditional_response (bool) – Used to change the behavior of the Response to check the original request for conditional response headers. See conditional_response_app() for more information.

  • charset (str or None) – Adds a charset Content-Type parameter. If no charset is provided and the Content-Type is text, then the default_charset will automatically be added. Currently the only Content-Type’s that allow for a charset are defined to be text/*, application/xml, and */*+xml. Any other Content-Type’s will not have a charset added. If a headerlist is provided this value is ignored.

All other response attributes may be set on the response by providing them as keyword arguments. A TypeError will be raised for any unexpected keywords.

Sub-classing notes:

  • The default_content_type is used as the default for the Content-Type header that is returned on the response. It is text/html.

  • The default_charset is used as the default character set to return on the Content-Type header, if the Content-Type allows for a charset parameter. Currently the only Content-Type’s that allow for a charset are defined to be: text/*, application/xml, and */*+xml. Any other Content-Type’s will not have a charset added.

  • The unicode_errors is set to strict, and access on a text will raise an error if it fails to decode the body.

  • default_conditional_response is set to False. This flag may be set to True so that all Response objects will attempt to check the original request for conditional response headers. See conditional_response_app() for more information.

  • default_body_encoding is set to ‘UTF-8’ by default. It exists to allow users to get/set the Response object using .text, even if no charset has been set for the Content-Type.

Initialize self. See help(type(self)) for accurate signature.

code = NotImplemented[source]
locator =[source]
explanation = Operation is not implemented.[source]