为django提供简单的JSONP支持
项目描述
为django提供简单的JSONP支持
安装
使用pip安装...
$ pip install django-jsonp
用法
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))
# it also works for CBVs
from django.views.generic import View
@jsonp
class DictResponse(View):
def get(self, request):
return HttpResponse("{'foo': 'bar'}")
项目详情
关闭
django_jsonp-0.3.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 7c7202303b6a86959a54568af5c9a435b35573beda688d80c25725717dd681e4 |
|
MD5 | da96dd8f6065fbbc946d174bfc419970 |
|
BLAKE2b-256 | 3f63ab476672025a0b436581d3bbea0652b05406f7b132d39ffb886baa4e2791 |