HttpResponse instance methods
def SetHeader(self, name, value)
# Set a header to the http response.
# - No return value.
# - <name> must be a not empty string.
# - <value> may be anything but cannot be None.
# An exception can be raised if arguments are not correct.
:arrow_forward: httpResponse.SwitchingProtocols(…)
def SwitchingProtocols(self, upgrade)
# Sends a special http response to upgrade the connection.
# - No return value.
# - <upgrade> must be a not empty string.
# An exception can be raised if <upgrade> is not correct.
:arrow_forward: httpResponse.ReturnStream(…)
def ReturnStream(self, code, stream)
# Sends a stream content to the http response.
# - No return value.
# - <code> is the http status code and must be a positive integer.
# - <stream> must be a readable buffer protocol object.
# An exception can be raised if arguments are not correct.
:arrow_forward: httpResponse.Return(…)
def Return(self, code, content=None)
# Sends an http response with or without content.
# - No return value.
# - <code> is the http status code and must be a positive integer.
# - <content> must be a string or in bytes or convertible into bytes or None.
# An exception can be raised if arguments are not correct.
:arrow_forward: httpResponse.ReturnJSON(…)
def ReturnJSON(self, code, obj)
# Sends an http response with a JSON content.
# - No return value.
# - <code> is the http status code and must be a positive integer.
# - <obj> can be anything and will be serialized (stringify process).
# An exception can be raised if arguments are not correct.
:arrow_forward: httpResponse.ReturnOk(…)
def ReturnOk(self, content=None)
# Sends a success http response with or without content.
# - No return value.
# - <content> must be a string or in bytes or convertible into bytes or None.
# An exception can be raised if <content> is not correct.
:arrow_forward: httpResponse.ReturnOkJSON(…)
def ReturnOkJSON(self, obj)
# Sends a success http response with a JSON content.
# - No return value.
# - <obj> can be anything and will be serialized (stringify process).
# An exception can be raised if <obj> is not correct.
:arrow_forward: httpResponse.ReturnFile(…)
def ReturnFile(self, filename, attachmentName=None)
# Sends a file to the http response.
# - No return value.
# - <filename> is the physical path of the file and must be a not empty string.
# - <attachmentName> can be the name of the file to save, in string, or None.
# If None, the user will see it "on the fly" in his browser, he will can save it otherwise.
# An exception can be raised if arguments are not correct.
:arrow_forward: httpResponse.ReturnNotModified(…)
def ReturnNotModified(self)
# Sends a not modified http response.
# Used in resources caching context.
# - No return value.
:arrow_forward: httpResponse.ReturnRedirect(…)
def ReturnRedirect(self, location)
# Sends a temporary redirect http response.
# Used to move the user to a new url.
# - No return value.
# - <location> is the relative or absolute URL and must be a not empty string.
# An exception can be raised if <location> is not correct.
:arrow_forward: httpResponse.ReturnBadRequest(…)
def ReturnBadRequest(self)
# Sends a bad request http response.
# Used for user request error.
# - No return value.
:arrow_forward: httpResponse.ReturnUnauthorized(…)
def ReturnUnauthorized(self, typeName, realm=None)
# Sends an unauthorized http response.
# Used if the user needs to authenticate.
# - No return value.
# - <typeName> is the name of required authentication and must be a not empty string.
# - <realm> is a name for the protected resource and can be a string or None.
# An exception can be raised if arguments are not correct.
:arrow_forward: httpResponse.ReturnForbidden(…)
def ReturnForbidden(self)
# Sends a forbidden http response.
# Used to indicate a denied access.
# - No return value.
:arrow_forward: httpResponse.ReturnNotFound(…)
def ReturnNotFound(self)
# Sends a not found http response.
# Used to indicate that the resource does not exist.
# - No return value.
:arrow_forward: httpResponse.ReturnMethodNotAllowed(…)
def ReturnMethodNotAllowed(self)
# Sends a method not allowed http response.
# Used if the method is not supported for resource.
# - No return value.
def ReturnEntityTooLarge(self)
# Sends an entity too large http response.
# Used for an excessive content size.
# - No return value.
:arrow_forward: httpResponse.ReturnInternalServerError(…)
def ReturnInternalServerError(self)
# Sends an internal server error http response.
# Used if an error has occurred.
# - No return value.
:arrow_forward: httpResponse.ReturnNotImplemented(…)
def ReturnNotImplemented(self)
# Sends a not implemented http response.
# Used in case of a non-existent process of the resource.
# - No return value.
:arrow_forward: httpResponse.ReturnServiceUnavailable(…)
def ReturnServiceUnavailable(self)
# Sends a service unavailable http response.
# Used if it is currently impossible to process the request.
# - No return value.
:arrow_forward: httpResponse.ReturnBasicAuthRequired(…)
def ReturnBasicAuthRequired(self)
# Sends an http response to indicate that "Basic" authentication is required.
# - No return value.
:arrow_forward: httpResponse.ReturnBearerAuthRequired(…)
def ReturnBearerAuthRequired(self)
# Sends an http response to indicate that "Bearer" authentication is required.
# - No return value.
评论