Skip to main content

Easy way to get the standard rest api response

Project description

rest_apiresponse

Standard way to get the REST api response.

Install

pip install rest_apiresponse

Usage

  1. Import rest_apiresponse
from rest_apiresponse.apiresponse import ApiResponse
  1. To get the response
ApiResponse.response_created(self)
ApiResponse.response_ok(self)
ApiResponse.response_internal_server_error(self)
ApiResponse.response_bad_request(self)
ApiResponse.response_unauthenticate(self)
ApiResponse.response_unauthorized(self)
ApiResponse.response_not_found(self)
ApiResponse.response_not_acceptable(self)
ApiResponse.response_not_acceptable(self)
  1. If you to change the default message:
ApiResponse.response_created(self, message='User created successfully.')
  1. Pass the data to response
data = {
	"id": 1,
	"name": "test"
}
ApiResponse.response_created(self, data=data, paginator=pagination_obj)

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

stark-rest-apiresponse-0.0.3.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stark_rest_apiresponse-0.0.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file stark-rest-apiresponse-0.0.3.tar.gz.

File metadata

  • Download URL: stark-rest-apiresponse-0.0.3.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.9

File hashes

Hashes for stark-rest-apiresponse-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a1642882c452ea45e6747e5ef237488da16aca9a3067044b3e42b135b187cd7c
MD5 98f0406075f725f2190b8bda540788f6
BLAKE2b-256 cef9684a18e3550f7460526024ee8c02b9481623966b5fb013d2c487e1a4ea10

See more details on using hashes here.

File details

Details for the file stark_rest_apiresponse-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: stark_rest_apiresponse-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.9

File hashes

Hashes for stark_rest_apiresponse-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c194db03a9460c07d75e665b22681bedd8e9b794d406b1f919944211eef7219c
MD5 38bf99e5dbc17819c8700c2098298803
BLAKE2b-256 909a9d01a463cafe7e7ca7cc17bf555ec0e3336a27bb0d8ff141924da6b6f620

See more details on using hashes here.

Supported by

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