| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
exceptions.BaseException --+
|
exceptions.Exception --+
|
CherryPyException --+
|
HTTPError
Exception used to return an HTTP error code (4xx-5xx) to the client.
This exception can be used to automatically send a response using a http status code, with an appropriate error page. It takes an optional ``status`` argument (which must be between 400 and 599); it defaults to 500 ("Internal Server Error"). It also takes an optional ``message`` argument, which will be returned in the response body. See `RFC2616 <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4>`_ for a complete list of available error codes and when to use them.
Examples:
raise cherrypy.HTTPError(403)
raise cherrypy.HTTPError(
"403 Forbidden", "You are not allowed to access this resource.")
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from Inherited from |
|||
|
|||
status = NoneThe HTTP status code. |
|||
code = NoneThe integer HTTP status code. |
|||
reason = NoneThe HTTP Reason-Phrase string. |
|||
|
|||
|
Inherited from Inherited from |
|||
|
|||
x.__init__(...) initializes x; see help(type(x)) for signature
|
Modify cherrypy.response status, headers, and body to represent self. CherryPy uses this internally, but you can also use it to create an HTTPError object and set its output without *raising* the exception. |
|
|||
statusThe HTTP status code. May be of type int or str (with a Reason-Phrase).
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Dec 2 09:59:36 2014 | http://epydoc.sourceforge.net |