How to use the whitenoise.httpstatus_backport.HTTPStatus function in whitenoise

To help you get started, we’ve selected a few whitenoise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github evansd / whitenoise / whitenoise / httpstatus_backport.py View on Github external
class HTTPStatus(int):

    phrase = None

    def __new__(cls, code, phrase):
        instance = int.__new__(cls, code)
        instance.phrase = phrase
        return instance


HTTPStatus.OK = HTTPStatus(200, "OK")
HTTPStatus.PARTIAL_CONTENT = HTTPStatus(206, "Partial Content")
HTTPStatus.FOUND = HTTPStatus(302, "Found")
HTTPStatus.NOT_MODIFIED = HTTPStatus(304, "Not Modified")
HTTPStatus.METHOD_NOT_ALLOWED = HTTPStatus(405, "Method Not Allowed")
HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE = HTTPStatus(416, "Range Not Satisfiable")
github evansd / whitenoise / whitenoise / httpstatus_backport.py View on Github external
class HTTPStatus(int):

    phrase = None

    def __new__(cls, code, phrase):
        instance = int.__new__(cls, code)
        instance.phrase = phrase
        return instance


HTTPStatus.OK = HTTPStatus(200, "OK")
HTTPStatus.PARTIAL_CONTENT = HTTPStatus(206, "Partial Content")
HTTPStatus.FOUND = HTTPStatus(302, "Found")
HTTPStatus.NOT_MODIFIED = HTTPStatus(304, "Not Modified")
HTTPStatus.METHOD_NOT_ALLOWED = HTTPStatus(405, "Method Not Allowed")
HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE = HTTPStatus(416, "Range Not Satisfiable")
github evansd / whitenoise / whitenoise / httpstatus_backport.py View on Github external
class HTTPStatus(int):

    phrase = None

    def __new__(cls, code, phrase):
        instance = int.__new__(cls, code)
        instance.phrase = phrase
        return instance


HTTPStatus.OK = HTTPStatus(200, "OK")
HTTPStatus.PARTIAL_CONTENT = HTTPStatus(206, "Partial Content")
HTTPStatus.FOUND = HTTPStatus(302, "Found")
HTTPStatus.NOT_MODIFIED = HTTPStatus(304, "Not Modified")
HTTPStatus.METHOD_NOT_ALLOWED = HTTPStatus(405, "Method Not Allowed")
HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE = HTTPStatus(416, "Range Not Satisfiable")
github evansd / whitenoise / whitenoise / httpstatus_backport.py View on Github external
"""


class HTTPStatus(int):

    phrase = None

    def __new__(cls, code, phrase):
        instance = int.__new__(cls, code)
        instance.phrase = phrase
        return instance


HTTPStatus.OK = HTTPStatus(200, "OK")
HTTPStatus.PARTIAL_CONTENT = HTTPStatus(206, "Partial Content")
HTTPStatus.FOUND = HTTPStatus(302, "Found")
HTTPStatus.NOT_MODIFIED = HTTPStatus(304, "Not Modified")
HTTPStatus.METHOD_NOT_ALLOWED = HTTPStatus(405, "Method Not Allowed")
HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE = HTTPStatus(416, "Range Not Satisfiable")
github evansd / whitenoise / whitenoise / httpstatus_backport.py View on Github external
This implements just enough of the interface for our purposes, it does not
attempt to be a full implementation.
"""


class HTTPStatus(int):

    phrase = None

    def __new__(cls, code, phrase):
        instance = int.__new__(cls, code)
        instance.phrase = phrase
        return instance


HTTPStatus.OK = HTTPStatus(200, "OK")
HTTPStatus.PARTIAL_CONTENT = HTTPStatus(206, "Partial Content")
HTTPStatus.FOUND = HTTPStatus(302, "Found")
HTTPStatus.NOT_MODIFIED = HTTPStatus(304, "Not Modified")
HTTPStatus.METHOD_NOT_ALLOWED = HTTPStatus(405, "Method Not Allowed")
HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE = HTTPStatus(416, "Range Not Satisfiable")
github evansd / whitenoise / whitenoise / responders.py View on Github external
def get_range_not_satisfiable_response(file_handle, size):
        if file_handle is not None:
            file_handle.close()
        return Response(
            HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE,
            [("Content-Range", "bytes */{}".format(size))],
            None,
        )
github evansd / whitenoise / whitenoise / httpstatus_backport.py View on Github external
attempt to be a full implementation.
"""


class HTTPStatus(int):

    phrase = None

    def __new__(cls, code, phrase):
        instance = int.__new__(cls, code)
        instance.phrase = phrase
        return instance


HTTPStatus.OK = HTTPStatus(200, "OK")
HTTPStatus.PARTIAL_CONTENT = HTTPStatus(206, "Partial Content")
HTTPStatus.FOUND = HTTPStatus(302, "Found")
HTTPStatus.NOT_MODIFIED = HTTPStatus(304, "Not Modified")
HTTPStatus.METHOD_NOT_ALLOWED = HTTPStatus(405, "Method Not Allowed")
HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE = HTTPStatus(416, "Range Not Satisfiable")