# django-modern-rpc
> **Important note**: This project is under development, and is not ready for production environment.
> You are free to install and test it and provide feedback or make pull
> request if you want to add a feature, report a bug or try to resolve
> one of them.
## Information
django-modern-rpc is a free, lightweight RPC server for Django projects.
It supports JSON-RPC and XML-RPC requests under python 2.7, 3.3, 3.4,
3.5 and Django 1.8, 1.9 and 1.10.
## Features
The project is in active development, so all the features are not yet
implemented. The list of available features is:
- XML-RPC & JSON-RPC support
- Usual errors are correctly reported to user according to the standard
- Multi-entry point, with specific methods and protocol attached
## Features planned to implement
- System introspection methods (listMethods(), methodHelp(),
methodSignature(), etc.)
- Multi-call
## Installation
There is no pypi package for now. This will be availble in the future.
To use django-modern-rpc, you have to clone it and import its path to
your PYTHONPATH when starting Django
## Quick start
Decorate the methods you want to make reachable from RPC call:
```python
# In myproject/rpc_app/rpc_methods.py
from modernrpc.core import rpc_method
@rpc_method()
def add(a, b):
return a + b
```
and make sure these functions are imported at Django startup. A simple
way to do that is to import them in your app's modeul:
```python
# In myproject/rpc_app/__init__.py
from rpc_app.rpc_methods import add
```
Now, you have to declare an entry point. This is a standard Django view
which will automatically route the request to the right handler (for
JSON-RPC or XML-RPC call) and call the method on the server.
```python
# In myproject/rpc_app/urls.py
from django.conf.urls import url
from modernrpc.views import RPCEntryPoint
urlpatterns = [
url(r'^rpc/', RPCEntryPoint.as_view(), name="rpc_entry_point"),
]
```
Now, you can call the function add from a client:
```python
try:
# Python 3
import xmlrpc.client as xmlrpc_module
except ImportError:
# Python 2
import xmlrpclib as xmlrpc_module
client = xmlrpc_module.ServerProxy('http://127.0.0.1:8000/all-rpc/')
print(client.add(2, 3))
# Returns: 5
```
[](https://travis-ci.org/alorence/django-modern-rpc)
> **Important note**: This project is under development, and is not ready for production environment.
> You are free to install and test it and provide feedback or make pull
> request if you want to add a feature, report a bug or try to resolve
> one of them.
## Information
django-modern-rpc is a free, lightweight RPC server for Django projects.
It supports JSON-RPC and XML-RPC requests under python 2.7, 3.3, 3.4,
3.5 and Django 1.8, 1.9 and 1.10.
## Features
The project is in active development, so all the features are not yet
implemented. The list of available features is:
- XML-RPC & JSON-RPC support
- Usual errors are correctly reported to user according to the standard
- Multi-entry point, with specific methods and protocol attached
## Features planned to implement
- System introspection methods (listMethods(), methodHelp(),
methodSignature(), etc.)
- Multi-call
## Installation
There is no pypi package for now. This will be availble in the future.
To use django-modern-rpc, you have to clone it and import its path to
your PYTHONPATH when starting Django
## Quick start
Decorate the methods you want to make reachable from RPC call:
```python
# In myproject/rpc_app/rpc_methods.py
from modernrpc.core import rpc_method
@rpc_method()
def add(a, b):
return a + b
```
and make sure these functions are imported at Django startup. A simple
way to do that is to import them in your app's modeul:
```python
# In myproject/rpc_app/__init__.py
from rpc_app.rpc_methods import add
```
Now, you have to declare an entry point. This is a standard Django view
which will automatically route the request to the right handler (for
JSON-RPC or XML-RPC call) and call the method on the server.
```python
# In myproject/rpc_app/urls.py
from django.conf.urls import url
from modernrpc.views import RPCEntryPoint
urlpatterns = [
url(r'^rpc/', RPCEntryPoint.as_view(), name="rpc_entry_point"),
]
```
Now, you can call the function add from a client:
```python
try:
# Python 3
import xmlrpc.client as xmlrpc_module
except ImportError:
# Python 2
import xmlrpclib as xmlrpc_module
client = xmlrpc_module.ServerProxy('http://127.0.0.1:8000/all-rpc/')
print(client.add(2, 3))
# Returns: 5
```
[](https://travis-ci.org/alorence/django-modern-rpc)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-modern-rpc-0.1.0.tar.gz.
File metadata
- Download URL: django-modern-rpc-0.1.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f63c0239bef3b060a614c5d9a9549fe010fa3b40b2e74d1245f979f7c4552c40
|
|
| MD5 |
2a15949e70f849918676555d4e8f99b9
|
|
| BLAKE2b-256 |
5b4bcd46319fe5cd9c0f9b13d14312bda021fb6ee97cf29351fd2f96d7a8601c
|
File details
Details for the file django_modern_rpc-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: django_modern_rpc-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
945b25cf68cdac37524bbf44d4a2dfa13489ac1893900aa83f6bfab4e0ade7e9
|
|
| MD5 |
bc6ce3dcd69b01e55bf533242784b757
|
|
| BLAKE2b-256 |
16218a3fc5174f099f2ab71cf89b2ff6c2fa7f65207e4c3aacfe169e8d7eaf12
|