Skip to main content

django-modern-rpc

https://travis-ci.org/alorence/django-modern-rpc.svg?branch=master https://coveralls.io/repos/github/alorence/django-modern-rpc/badge.svg?branch=master https://codecov.io/gh/alorence/django-modern-rpc/branch/master/graph/badge.svg https://readthedocs.org/projects/django-modern-rpc/badge/?version=latest https://badge.fury.io/py/django-modern-rpc.svg https://img.shields.io/badge/demo-online-brightgreen.svg

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-modern-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.

Metadata

Release files for django-modern-rpc 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-modern-rpc 0.9.0
File Size Uploaded
django-modern-rpc-0.9.0.tar.gz 24.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-modern-rpc 0.9.0
File Interpreter ABI Platform
django_modern_rpc-0.9.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 53.8 kB

Release files / django-modern-rpc-0.9.0.tar.gz

Download URL django-modern-rpc-0.9.0.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
80b43826bf9d9d634eed0ad524691248e9a22db578454188c7be9b08de7733fa
BLAKE2b-256 checksum
How to use checksums
7df5cead1f45d29fad2da4645d381935368b6e02bc178667b9d49de06e9e765b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_modern_rpc-0.9.0-py2.py3-none-any.whl

Download URL django_modern_rpc-0.9.0-py2.py3-none-any.whl
Size 29.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d7358743d6c23b24fca87247e6a58593007a159f1cc09545a6ec51bfac9ba848
BLAKE2b-256 checksum
How to use checksums
99862859cacc3de6e98fbdf8178bbaf4f6209a35540258dfdd378b74c7f588c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

2.1.0

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.12.1

2 release files

0.11.1

2 release files

0.11.0

2 release files

This release

0.9.0 This release

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

3 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page