Skip to main content

Django api view

Project description

https://travis-ci.org/anthon-alindada/django_api_view.svg?branch=master https://codecov.io/gh/anthon-alindada/django_api_view/branch/master/graph/badge.svg

Django basic api view and api response.

Documentation

The full documentation is at https://django_api_view.readthedocs.io.

Quickstart

Install Django api view. In the command line:

pip install django_api_view

Configuration

Add ‘django_api_view’ it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'django_api_view',
    ...
)

Simple usage

Read full documentation for full features https://django_api_view.readthedocs.io.

Api View

ApiView will automatically parse post data.

It accepts 'application/json', 'application/x-www-form-urlencoded', or 'multipart/form-data'

For example:

from django_api_view.api_view import ApiView

class BasicApiView(ApiView):

    def get(self, request):
        # For get method use 'GET' to get parameters
        email = request.GET.get('email')

    def post(self, request):
        # For post method use 'data' to get parameters
        email = request.data.get('email')

Api Response

Api response retuns json response.

Basic example:

from django_api_view.api_response import ApiResponse

def get(request):
    # 'data' parameter is optional
    return ApiResponse().success(data={})

Version 0.1 (2017-07-25)

  • Initial release.

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django_api_view-0.1.1-py2.py3-none-any.whl (7.1 kB) Copy SHA256 hash SHA256 Wheel py2.py3
django_api_view-0.1.1.tar.gz (5.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page