This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Simple and modern JSON-RPC and XML-RPC server implementation for Django

Project Description

Description

Django-modern-rpc provides a simple solution to implement a remote procedure call (RPC) server as part of your Django project. It supports all major Django and Python versions.

Project’s main features are:

  • Simple and pythonic API
  • Python 2.7, 3.3, 3.4, 3.5 and 3.6
  • Django 1.8, 1.9, 1.10 and 1.11
  • XML-RPC and JSON-RPC 2.0 support (JSON-RPC 1.0 not supported)
  • HTTP Basic Auth support
  • Custom authentication support
  • Automatic protocol detection based on request’s Content-Type header
  • High-level error management based on exceptions
  • Multiple entry points, with specific methods and protocol attached
  • RPC Methods documentation generated automatically, based on docstrings
  • System introspection methods:

Quick start

  1. Use pip to install the package in your environment:

    pip install django-modern-rpc
    
  2. Add it to your Django applications, in settings.py:

    INSTALLED_APPS = [
        ...
        'modernrpc',
    ]
    
  3. Declare an entry point, a view generating correct RPC responses to incoming requests:

    # In myproject/rpc_app/urls.py
    from django.conf.urls import url
    
    from modernrpc.views import RPCEntryPoint
    
    urlpatterns = [
        url(r'^rpc/', RPCEntryPoint.as_view()),
    ]
    
  4. Use @rpc_method to register a global function in django-moder-rpc registry:

    # In myproject/rpc_app/rpc_methods.py
    from modernrpc.core import rpc_method
    
    @rpc_method
    def add(a, b):
        return a + b
    
  5. Declare the list of python modules containing your RPC methods, in settings.py:

    MODERNRPC_METHODS_MODULES = [
        'rpc_app.rpc_methods'
    ]
    

Now, you can call the method add from a client:

>>> from xmlrpc.client import ServerProxy
>>> client = ServerProxy('http://localhost:8000/rpc/')
>>> print(client.add(2, 3))
5

For more information, please read the full documentation.

Release History

Release History

This version
History Node

0.6.0

History Node

0.5.2

History Node

0.5.1

History Node

0.5.0

History Node

0.4.2

History Node

0.4.1

History Node

0.4.0

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_modern_rpc-0.6.0-py2.py3-none-any.whl (26.7 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel May 13, 2017
django-modern-rpc-0.6.0.tar.gz (22.0 kB) Copy SHA256 Checksum SHA256 Source May 13, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting