Skip to main content

Return HTTP responses in a easier way

Project description

    # last on the list

def view(request):
    # return HTTP response with status code 200 (default)

def another_view(request):
    # return HTTP response with content and status code 401
    return 401, 'Not authorized'

def yet_another_view(request):
    # return JSON/JSONP response with content and default status code
    return {'foo': 'bar'}

In a nutshell, you can either return:

  1. an object, which will be serialized into the response’s content.

  2. a tuple, which first element defines the status code and the second the content of the response.

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

django-easy-response-1.0.0.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

django_easy_response-1.0.0-py2-none-any.whl (6.5 kB view hashes)

Uploaded Python 2

Supported by

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