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 stark-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.4.tar.gz (2.5 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.4-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stark-rest-apiresponse-0.0.4.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.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.4.tar.gz
Algorithm Hash digest
SHA256 e935852847d04379f48965d9d1e9ec41c1c310bbf5ab58ff3e402a7878de28ff
MD5 240ff1c7276a3ae11b11374b9b04681c
BLAKE2b-256 626a6cd9a0feb163683a9a056b6af3ad2e12b440e574f0a1d24c37fb012c8a93

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stark_rest_apiresponse-0.0.4-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.4.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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a84b9b16ff849b92fb9d3ceae2c6b9df85b4788ae269db4dee7d5cbc8a6f73f6
MD5 45bfb1fd2258d0091df21309485d4d33
BLAKE2b-256 bc8448dad86e93affad637958a385d2a9edd2dd0beb14bd4229141a85eca530e

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