The main target of this library is to standardize the request response in case of using flask-restplus library.
Project description
http_request_response
Introduction
Getting Started
Contributors
License
Introduction
The main target of this library is to standardize the request response in case of using flask-restplus library.Getting Started
In order to install, open the command prompt and type ✌️:pip install http-request-response
In order to import:
from http_request_response import RequestUtilities
Mainly this library has two classes:
- RequestResponse
- RequestUtilities
The response when it is used is like the following:
Response body
{
"status_code": ,
"data": ,
"message": ""
}
In order to use, the endpoint-function should be decorated with try_except decorartors:
@cls.api.route('/')
class ItemPost(Resource):
##### Post
@RequestUtilities.try_except
def post(self):
""" Create a new record """
return business_obj.create(request.body_args)
You have to make sure that the function returns two items:
- The first one is an object of status code (refer to http_status_code library)
- JSON serializable data
Contributors
This project exists thanks to all the people who contribute. [Contribute]. ""
License
This library is licensed under the MIT License - see the LICENSE.md file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for http_request_response-0.0.22.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9ef2295034aaf9394a029ec9c25c0949749f5cbb18c539aca58af676143a83c |
|
MD5 | 148d0a8ec3440b9ac7f4c04ed0d70abe |
|
BLAKE2b-256 | 1c83bff98e50aa0b86861adcba5be1bb26acf3b3c65383b338fc008533755e76 |
Close
Hashes for http_request_response-0.0.22-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26ff8fde217f4488c1dae606cf00f2ced1abf5db6a012fd120dfe39250047d1c |
|
MD5 | 2728cb86ef1c679152c84d7bc8c13dfa |
|
BLAKE2b-256 | 25442e598b78bc7dae0dd7a3a95c08b6df97ae341b5d20cf282d555d3e07522c |