Skip to main content

HTTP methods that python supports

Project description

HTTP Request Methods

HTTP verbs that python core's HTTP parser supports.

This module provides an export that is just like HTTP request methods from Developer Mozilla, with the following differences:

  • All method names are lower-cased.
  • All method names are upper-cased.

HTTP Status Codes

Also this module provides a list with all HTTP Status Codes and you can get only status description by status code or get all status.

We use the methods package from Node.js as inspiration

Install

Install and update using Pip:

$ pip install httpmethods

API

import httpmethods as methods

A Simple Example

from httpmethods import get_http_methods

for method in get_http_methods():
    print(method)
$ get
$ post
$ put
$ delete
$ ...
from httpmethods import get_http_methods

for _method in get_http_methods(uppercase=True):
    print(_method)
$ GET
$ POST
$ PUT
$ DELETE
$ ...
from httpmethods import get_status_codes, get_status_by_code

print(get_status_by_code(200))
print(get_status_by_code(401))
print(get_status_codes())
$ 200 OK
$ 401 Unauthorized
$ {
$   100: "100 Continue",
$   101: "101 Switching Protocols",
$   103: "103 Early Hints",
$   ...
$ }

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

httpmethods-1.0.5.tar.gz (3.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page