Skip to main content

Handles JSONRPC and XMLRPC requests easily with Django

Project description

Prerequisites

RPC4Django has been tested on Mac OS, Linux and Windows.

Installation

pip install rpc4django[reST]

Configuration

  1. First, you need to add new url pattern to your root urls.py file. You can replace r'^RPC2$' with anything you like.

    # urls.py
    
    from rpc4django.views import serve_rpc_request
    
    urlpatterns = (
        # rpc4django will need to be in your Python path
        url(r'^RPC2$', serve_rpc_request),
    )
  2. Second, add RPC4Django to the list of installed applications in your settings.py.

    # settings.py
    
    INSTALLED_APPS = (
        'rpc4django',
    )
  3. Lastly, you need to let RPC4Django know which methods to make available. RPC4Django recursively imports all the apps in INSTALLED_APPS and makes any methods importable via __init__.py with the @rpcmethod decorator available as RPC methods. You can always write your RPC methods in another module and simply import it in __init__.py.

    # testapp/__init__.py
    
    from rpc4django import rpcmethod
    
    # The doc string supports reST if docutils is installed
    @rpcmethod(name='mynamespace.add', signature=['int', 'int', 'int'])
    def add(a, b):
        '''Adds two numbers together
        >>> add(1, 2)
        3
        '''
    
        return a+b

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

rpc4django-0.5.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

rpc4django-0.5.0-py2.py3-none-any.whl (19.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file rpc4django-0.5.0.tar.gz.

File metadata

  • Download URL: rpc4django-0.5.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for rpc4django-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2e96b08c0ab83787a146fc4c288da4510dc2b7173f8f3ee31035d880e39635ee
MD5 fc7d23ac591b886a8a05c1a14bb6e26f
BLAKE2b-256 9a070a2da42cdd9bc3c933184894b1ac6a55cceb53c8bd726283d2443510b36f

See more details on using hashes here.

File details

Details for the file rpc4django-0.5.0-py2.py3-none-any.whl.

File metadata

  • Download URL: rpc4django-0.5.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for rpc4django-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ad72f9ca3286088d73533ab5b5ce494a0e42459e13898de1cb1b9489535e1e02
MD5 3e02773bc4e6bd1f724fa0c732190c9e
BLAKE2b-256 ce97ef9d7a4c0a59360e0bf32f1dca01895a9ca25cae993174ea03a68c8b7543

See more details on using hashes here.

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