qxjsonrpc 0.0.5 released - heavy refactoring, many improvements

Ferenczi Viktor python at cx.hu
Sat Apr 7 01:59:18 CEST 2007


The qxjsonrpc package contains everything to implement JSON-RPC backends
for WEB applications using the QooXDoo ( http://qooxdoo.org ) library or 
simply requiring RPC functionality.

Download, example, etc.:
http://python.cx.hu/qxjsonrpc

Features:

- Supports four type of HTTP transport:
  GET, POST (_data_ and separate variables) and ScriptTransport.

- Any object can be a service, any method can be easily published
  using decorators.

- Access control decorators: @public, @domain, @session and @fail.

- It's possible to implement new access control methods easily,
  such as methods accessible only to administrators, etc.

- Correct error handling by exception class hierarchy.

- Session support (requires cookies when using the HTTP transport),
  Session object is automatically passed to the method.

- Request object is passed to a method if decorated by @request,
  this gives access to all aspects of request handling.

- Uses python-cjson-1.0.3x or simplejson to encode/decode JSON
  represenation. Extends both of them to transparently handle
  python date and datetime objects.

- Simple implementation, the package's source code is fully documented
  by docstrings and comments.

- Actively developed and bugfixed. (But very young.) More transports
  and server interfaces are planned (WSGI, CherryPy, WebStack, etc.).
  Expect more documentation, tests and examples.

- Supports Python 2.4 and up, tested with 2.5.0.

Highlights of this release:

- Refactored into a real python package,
  now it has standard distutils install script.

- Session support has been implemented and tested.

- Source code is fully documentated (docstrings) and commented.

- No tests using QooXdoo components for now,
  they are expected in the next release.

Example:

import math
import qxjsonrpc
import qxjsonrpc.http

class MyService(object):
    @qxjsonrpc.public
    def getPi(self, *args):
        print 'Called: getPi%r'%(args,)
        return math.pi

server=qxjsonrpc.http.HTTPServer()
server.setService('myservice', MyService())
server.serve_forever()

Run the script above, then open your browser and navigate to:
http://127.0.0.1:8000/?id=1&service=myservice&method=getPi

You will get a valid JSON-RPC response:
{"error": null, "id": 1, "result": 3.14159265359}

Please report bugs to: python at cx.hu 



More information about the Python-announce-list mailing list