MCPcopy Create free account
hub / github.com/ActiveState/code / HTTPError

Class HTTPError

recipes/Python/576906_Python_3_WSGI_Server/recipe-576906.py:634–647  ·  view source on GitHub ↗

An exception that will turn into an HTTP error response.

Source from the content-addressed store, hash-verified

632
633
634class HTTPError(Exception):
635 """An exception that will turn into an HTTP error response."""
636 def __init__(self, status_code, log_message=None, *args):
637 self.status_code = status_code
638 self.log_message = log_message
639 self.args = args
640
641 def __str__(self):
642 message = "HTTP %d: %s" % (
643 self.status_code, http.client.responses[self.status_code])
644 if self.log_message:
645 return message + " (" + (self.log_message % self.args) + ")"
646 else:
647 return message
648
649
650class ErrorHandler(RequestHandler):

Callers 9

headMethod · 0.85
getMethod · 0.85
postMethod · 0.85
deleteMethod · 0.85
putMethod · 0.85
get_argumentMethod · 0.85
_executeMethod · 0.85
prepareMethod · 0.85
getMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected