Skip to content

russian-developer/pyjsonrpc2.0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Current version of json rpc working with specificati
on of jsonrpc version 2.0. Please see specification 
on http://groups.google.com/group/json-rpc/web/json-
rpc-1-2-proposal . You can use pyjsonrpc2 as client
and as server but server version working now only as
wsgi handler.
                 Thx N1ck Kuznetsov for answer on my
                                   freaking question
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Usage as client:
>>> import pyjsonrpc2
>>> c = pyjsonrpc2.JsonRPCClient('http://my.site.edu/json/rpc/path/')
>>> c.my_method('test')
test
>>> c.my_method(*['test'])
test
>>> c.my_method(**{'variable_name': 'test'})
test


Usage as server:
>>> import pyjsonrpc2
>>> class Methods(pyjsonrpc2.JsonRPCServer):
...     def my_method(variable_name):
...         return variable_name
...
>>> c = Methods()
>>> c("""{'jsonrpc': '2.0', 'method': 'my_method', 'params': 'test'}""")
test
>>>


JAVASCRIPT
Example usage:

//by form
$("form").jsonrpc('check_username');

//custom post element
new Request.JSONRPC({name:'check_username',url:'/json'}).post($("form"))

//custom send object
new Request.JSONRPC({name:'check_username',url:'/json'}).send({username:"admin"})

var creater = function (text) {
    return function (){
        console.log(text,arguments)
        }
    };
$("form").set('jsonrpc',{name:'check_username', url:'/json',
    {
        onFailure: creater("fail"),
        onSuccess: creater("success"),
    }
}).jsonrpc()

About

Python JsonRPC under specification v.2.0

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published