pyhttpstatus-utils

Extension of Python Standard Library http.HTTPStatus providing addtional utilities.


Keywords
http, httpstatus, utilities, tune
License
MIT
Install
pip install pyhttpstatus-utils==0.1.3

Documentation

pyhttpstatus-utils

Extension of Python Standard Library's http.HTTPStatus providing mapping of HTTP statuses.

Badges

docs Documentation Status License Status
info Hit Count Contributors
tests Travis-CI Build Status Code Coverage Status
package PyPI Package latest release Supported versions
other Requirements Status

Install

pip install pyhttpstatus-utils

Functions

  • create_http_status_dict(override_dict=None): Create HTTP Status Dictionary with Overrides if provided.
  • get_http_status_desc(http_status_code): Get HTTP status code description.
  • get_http_status_name(http_status_code): Get HTTP status code name.
  • get_http_status_phrase(http_status_code): Get HTTP status code phrase.
  • get_http_status_type(http_status_code): Get HTTP status code type.
  • is_http_status_successful(http_status_code): Check if HTTP Status Code is type Successful
  • is_http_status_type(http_status_code): Match if provided HTTP Status Code is expected HTTP Status Code Type.
  • validate_http_code(http_code, minimum=100, maximum=599, strict=True, default_http_code=0): Validate HTTP code. If strict, throw, else just return default_http_code.

Dictionaries

  • HTTP_STATUS_DICT: Extracted from http.HTTPStatus, a dictionary of each HTTP Status' name, code, phrase, and description.
  • HTTP_STATUS_PHRASE_DICT: Phrases of HTTP status codes.
  • HTTP_STATUS_DESC_DICT: Description of HTTP status codes.
  • HTTP_STATUS_TYPE_DICT: Types of HTTP status codes.

Enum Classes

  • HttpStatusCode: Static enumeration of HTTP status mapping names to codes
  • HttpStatusType: Static enumeration of HTTP status mapping types to phrase
  • HttpStatusCodeType: Int enumeration of HTTP status mapping types to codes

HTTP Status Code Types

  • 100: HttpStatusType.INFORMATIONAL,
  • 200: HttpStatusType.SUCCESSFUL,
  • 300: HttpStatusType.REDIRECTION,
  • 400: HttpStatusType.CLIENT_ERROR,
  • 500: HttpStatusType.SERVER_ERROR

Requirements

pyhttpstatus-utils module is built upon Python 3 and has dependencies upon several Python modules available within Python Package Index PyPI.

make install-requirements

or

python3 -m pip uninstall --yes --no-input -r requirements.txt
python3 -m pip install --upgrade -r requirements.txt