Skip to main content

The set of standard http constants for headers and statuses

Project description

Http Constants

A set of constants for HTTP statuses and headers.

Installation

You can install Http Constants from PyPI:

pip install http-constants

The library is supported on Python 3.7+.

Usage

Headers

from http_constants.headers import HttpHeaders

>>> HttpHeaders.ACCEPT
'Accept'

>>> HttpHeaders.CONTENT_TYPE_VALUES.json
'application/json'

Statuses

from http_constants.status import HttpStatus

>>> HttpStatus.SERVICE_UNAVAILABLE
<HttpStatus.SERVICE_UNAVAILABLE: (503, 'Service Unavailable')>

>>> HttpStatus.SERVICE_UNAVAILABLE.value
503

>>> int(HttpStatus.SERVICE_UNAVAILABLE)
503

>>> HttpStatus.SERVICE_UNAVAILABLE.reason_phrase
'Service Unavailable'

>>> str(HttpStatus.SERVICE_UNAVAILABLE)
'503 SERVICE_UNAVAILABLE'

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

http-constants-0.5.0.tar.gz (6.3 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