Simple JSONP support for django
Project description
# django-jsonp
Simple JSONP support for django
[![Coverage Status](https://coveralls.io/repos/ZhukovAlexander/django-jsonp/badge.svg?branch=master&service=github)](https://coveralls.io/github/ZhukovAlexander/django-jsonp?branch=master)
[![Build Status](https://travis-ci.org/ZhukovAlexander/django-jsonp.svg)](https://travis-ci.org/ZhukovAlexander/django-jsonp)
[![PyPI version](https://badge.fury.io/py/django_jsonp.svg)](http://badge.fury.io/py/django_jsonp)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ZhukovAlexander/django-jsonp/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ZhukovAlexander/django-jsonp/?branch=master)
[![Can I Use Python 3?](https://caniusepython3.com/check/fcd6cf8c-0bba-4f6a-a00f-24f7b2476e40.svg)](https://caniusepython3.com/check/fcd6cf8c-0bba-4f6a-a00f-24f7b2476e40)
[![Code Health](https://landscape.io/github/ZhukovAlexander/django-jsonp/master/landscape.svg?style=flat)](https://landscape.io/github/ZhukovAlexander/django-jsonp/master)
## Installation
Install using `pip`...
```bash
$ pip install django-jsonp
```
## Usage
```python
from djsonp import jsonp, JSONPResponse, get_callback
# decorate something that returns a dict-like object
@jsonp
def my_view(request):
return {'foo': 'bar'}
# it can work with an HttpResponse instances
@jsonp
def another_view(request):
return HttpResponse("{'foo': 'bar'}")
# or just return a JSONPResponse
def jsonp_view(request):
return JSONPResponse(data={'foo': 'bar', }, callback=get_callback(request))
```
Simple JSONP support for django
[![Coverage Status](https://coveralls.io/repos/ZhukovAlexander/django-jsonp/badge.svg?branch=master&service=github)](https://coveralls.io/github/ZhukovAlexander/django-jsonp?branch=master)
[![Build Status](https://travis-ci.org/ZhukovAlexander/django-jsonp.svg)](https://travis-ci.org/ZhukovAlexander/django-jsonp)
[![PyPI version](https://badge.fury.io/py/django_jsonp.svg)](http://badge.fury.io/py/django_jsonp)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ZhukovAlexander/django-jsonp/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ZhukovAlexander/django-jsonp/?branch=master)
[![Can I Use Python 3?](https://caniusepython3.com/check/fcd6cf8c-0bba-4f6a-a00f-24f7b2476e40.svg)](https://caniusepython3.com/check/fcd6cf8c-0bba-4f6a-a00f-24f7b2476e40)
[![Code Health](https://landscape.io/github/ZhukovAlexander/django-jsonp/master/landscape.svg?style=flat)](https://landscape.io/github/ZhukovAlexander/django-jsonp/master)
## Installation
Install using `pip`...
```bash
$ pip install django-jsonp
```
## Usage
```python
from djsonp import jsonp, JSONPResponse, get_callback
# decorate something that returns a dict-like object
@jsonp
def my_view(request):
return {'foo': 'bar'}
# it can work with an HttpResponse instances
@jsonp
def another_view(request):
return HttpResponse("{'foo': 'bar'}")
# or just return a JSONPResponse
def jsonp_view(request):
return JSONPResponse(data={'foo': 'bar', }, callback=get_callback(request))
```
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
django_jsonp-0.2.0.tar.gz
(2.8 kB
view details)
File details
Details for the file django_jsonp-0.2.0.tar.gz
.
File metadata
- Download URL: django_jsonp-0.2.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1264635e1c5c1682e0fa8dc32af599fee76ce244dd487123ae4aed8a00519c89 |
|
MD5 | 6850e9473bc9d4a6f4289731750fb336 |
|
BLAKE2b-256 | 8e08626983ca30cbb27e31d438acc4262ada0ed772e17fab3eb1c62d7957e9a4 |