Metadata-Version: 2.1
Name: status_codes
Version: 1.2.0
Description-Content-Type: text/markdown

# Status Codes Package

A Python package that provides functions for HTTP status codes, allowing you to easily generate responses with predefined or custom messages. This package is useful for handling API responses in web development.

## Features
Predefined HTTP Status Codes: Functions for common HTTP status codes like 200 (OK), 404 (Not Found), 500 (Internal Server Error), and more.
Custom Message Support: Optionally provide a custom message for any status code response.
Easy Integration: Simple functions that return dictionaries with the status code and message.

## Installation
You can install the package using pip:
`pip install status-codes`

## Usage
You can use the functions from the status_codes package to get HTTP responses with status codes and messages.

### Example:
`from status_codes import StatusCodes`

1. Using default messages
```
response = StatusCodes.ok_200()
print(response)  # Outputs: {'status': 200, 'message': 'Request succeeded.'}
```

2. Using custom messages
```
response = StatusCodes.ok_200("Custom success message")
print(response)  # Outputs: {'status': 200, 'message': 'Custom success message'}
```



## Available Functions
Here is a list of the available status code functions, each with an optional custom_message parameter:

### Informational 1xx
- continue_100
- switching_protocols_101
- processing_102
- early_hints_103

### Successful 2xx
- ok_200
- created_201
- accepted_202
- non_authoritative_information_203
- no_content_204
- reset_content_205
- partial_content_206
- multi_status_207
- already_reported_208
- im_used_226

### Redirection 3xx
- multiple_choices_300
- moved_permanently_301
- found_302
- see_other_303
- not_modified_304
- use_proxy_305
- use_proxy_306
- temporary_redirect_307
- permanent_redirect_308

### Client Error 4xx
- bad_request_400
- unauthorized_401
- payment_required_402
- forbidden_403
- not_found_404
- method_not_allowed_405
- not_acceptable_406
- proxy_authentication_required_407
- request_timeout_408
- conflict_409
- gone_410
- length_required_411
- precondition_failed_412
- payload_too_large_413
- uri_too_long_414
- unsupported_media_type_415
- range_not_satisfiable_416
- expectation_failed_417
- im_a_teapot_418
- misdirected_request_421
- unprocessable_content_422
- locked_423
- failed_dependency_424
- too_early_425
- upgrade_required_426
- precondition_required_428
- too_many_requests_429
- request_header_fields_too_large_431
- unavailable_for_legal_reasons_451

### Server Error 5xx
- internal_server_error_500
- not_implemented_501
- bad_gateway_502
- service_unavailable_503
- gateway_timeout_504
- http_version_not_supported_505
- variant_also_negotiates_506
- insufficient_storage_507
- loop_detected_508
- not_extended_510
- network_authentication_required_511




## Customization
Each function in the StatusCodes class allows you to pass an optional custom_message parameter. If no message is provided, the function uses a default message associated with the status code.

### Using custom message
```
response = StatusCodes.bad_request_400("Custom bad request message")
Outputs: {'status': 400, 'message': 'Custom bad request message'}
```

If no custom message is passed, it will use the default message:

### Without using custom message(ie., default)
```
response = StatusCodes.bad_request_400()
Outputs: {'status': 400, 'message': 'Bad request syntax.'}
```
