HTTP Status Codes
Table of Contents
Goal
HTTP status codes are three-digit numbers returned by a server in response to a client's request. They provide information about the status of the requested resource or operation, and are typically used by web browsers and other clients to determine how to handle the response.
Description
HTTP status codes are typically used by clients to determine how to handle the server's response. For example, a web browser might display a 404 Not Found error page if it receives that status code in response to a request for a web page. In addition, HTTP status codes can be used by servers to provide information about the status of an operation. For example, a server might return a 200 OK status code in response to a successful login request, or a 403 Forbidden status code in response to an unauthorized request to access a protected resource.
HTTP status codes are grouped into five categories to provide feedback regarding the requests made by the client.
Informational responses (100-199): These are interim responses that indicate that the client's request is being processed. They are not typically seen by users, as they are usually handled automatically by the client.
Successful responses (200-299): These indicate that the client's request was successfully processed by the server. The most commonly used status code in this category is 200 OK, which indicates that the request was successful.
Redirection messages (300-399): These indicate that the client must take additional action to complete the request. For example, a 301 Moved Permanently response indicates that the requested resource has been permanently moved to a new location.
Client error responses (400-499): These indicate that there was an error in the client's request. Common status codes in this category include 404 Not Found, which indicates that the requested resource could not be found, and 403 Forbidden, which indicates that the client does not have permission to access the requested resource.
Server error responses (500-599): These indicate that there was an error on the server side. Common status codes in this category include 500 Internal Server Error, which indicates a generic server error, and 503 Service Unavailable, which indicates that the server is temporarily unable to handle the request.
Getting Started
Dependencies
- Python 3.8
- Standard set by the source https://httpwg.org.
File Structure
responsecodes
|
├── LICENSE
├── README.md
├── responsecodes
│ ├── __init__.py
│ ├── __version__.py
│ └── responsecodes.py
├── setup.py
└── test
└── test_responsecodes.py
Installing
httpcodes installation
pip install responsecodes
- OR
$ python -m pip install responsecodes
- OR
**Clone the repository **
> git clone git@github.com:iamkamleshrangi/responsecodes.git
> cd responsecodes
> ..
Instructions
>>> import responsecodes
>>>
>>> response_code = 200
>>> responsecodes.get_response_by_code(response_code)
{'code': 200,
'category': 'Successful responses',
'short_description': '200 OK',
'description': 'The request succeeded. The result meaning of "success" depends on the HTTP method:'}
>>>
>>> responsecodes.get_all_responses()
'{100: {'code': 100,
'category': 'Information...'
>>>
>>> responsecodes.get_all_categories()
['1xx informational response – the request was received, continuing process',
'2xx successful – the request was successfully received, understood, and accepted',
'3xx redirection – further action needs to be taken in order to complete the request',
'4xx client error – the request contains bad syntax or cannot be fulfilled',
'5xx server error – the server failed to fulfil an apparently valid request']
>>>
>>> responsecodes.is_successful_response(response_code)
True
>>> responsecodes.is_client_error_response(response_code)
False
>>> responsecodes.is_server_error_response(response_code)
False
>>>
>>>
Resources
For more information about HTTP status codes, see the HTTP/1.1 Status Code Definitions specification.
Metadata
Release files for responsecodes 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| responsecodes-0.0.2.tar.gz | 14.6 kB | Without provenance | Details |
Release files / responsecodes-0.0.2.tar.gz
| Download URL | responsecodes-0.0.2.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f832b0af0a9becc99b639d7da5f4578dc3d7c4dadd116cbda33a2eb95698fc24
|
|
BLAKE2b-256 checksum How to use checksums |
741fc13ee5cb2546a9c3b794ec4cc29eb449e42815bd93dc6ac4135f6adafa5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Security for responsecodes 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.