CARVIEW |
Select Language
HTTP/2 200
server: nginx
content-type: text/html;charset=utf-8
cache-control: must-revalidate
expires: Fri, 01 Jan 1999 00:00:00 GMT
set-cookie: trac_form_token=507bf69e1987017965ad747f; HttpOnly; Path=/; Secure
set-cookie: trac_session=98881b64bec31ec63be080c1; expires=Tue, 21 Oct 2025 05:26:16 GMT; HttpOnly; Path=/; Secure
strict-transport-security: max-age=31536000; includeSubDomains; preload
permissions-policy: interest-cohort=()
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
accept-ranges: bytes
via: 1.1 varnish, 1.1 varnish
date: Wed, 23 Jul 2025 05:26:16 GMT
x-served-by: cache-fra-etou8220167-FRA, cache-bom-vanm7210049-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753248376.906178,VS0,VE335
vary: Accept-Encoding
Django-JSON-RPC – Django
Back to Top
Django
The web framework for perfectionists with deadlines.
Issues
Django JSON-RPC
A basic JSON-RPC Implementation for Django powered sites (see https://github.com/anaoum/django-json-rpc).
Features:
Simple, pythonic API Supports JSON-RPC 2.0 Spec
The basic API:
project/app/views.py
from pe.jsonrpc.views import JsonRpcView from pe.jsonrpc.decorators import publicmethod class TestRpcMethods(object): namespace = "test" @publicmethod def hello(self, who="World"): return "Hello, %s!" % who @publicmethod def echo(self, value): return value rpc = JsonRpcView.as_view(classes=[TestRpcMethods])
project/urls.py
from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^rpc/json/$', 'app.views.rpc'), )
To test your service: You can test the service with jsonrpclib (https://github.com/joshmarshall/jsonrpclib) or similar:
>>> from jsonrpclib import Server >>> s = Server('https://localhost:8000/rpc/json/') >>> s.test.hello() u'Hello, World!' >>> s.test.hello('Andrew') u'Hello, Andrew!' >>> s.test.hello(who='Bob') u'Hello, Bob!' >>> s.test.echo('This is a test...') u'This is a test...'
Last modified
14 years ago
Last modified on Mar 21, 2011, 12:59:20 AM
Note:
See TracWiki
for help on using the wiki.
Download in other formats:
Django Links
Learn More
Get Involved
Follow Us
- Hosting by In-kind donors
- Design by Threespot &
© 2005-2025 Django SoftwareFoundation unless otherwise noted. Django is a registered trademark of the Django Software Foundation.