Skip to content

edgarrmondragon/backports.httpmethod

Repository files navigation

backports.httpmethod

PyPI - Version PyPI - Python Version

A backport of Python 3.11+ http.HTTPMethod enum for Python 3.7+.


Table of Contents

Installation

pip install backports.httpmethod

Usage

import sys

if sys.version_info >= (3, 11):
    from http import HTTPMethod
else:
    from backports.httpmethod import HTTPMethod


HTTPMethod.GET == 'GET'  # True
HTTPMethod.GET.value  # 'GET'
HTTPMethod.GET.description  # 'Retrieve the target.'
list(HTTPMethod)[:3] # [<HTTPMethod.GET: 'GET'>, <HTTPMethod.HEAD: 'HEAD'>, <HTTPMethod.POST: 'POST'>]

License

backports-httpmethod is distributed under the terms of the MIT license.