Skip to main content

Code for creating Twisted JSON-RPC servers and clients.

Project description

Introduction

txJSON-RPC allows you to create async Python JSON-RPC servers and clients either over HTTP or directly on TCP with the Netstring protocol. txJSON-RPC is written in Twisted.

Features

  • Asynchronous JSON-RPC server and client code.

  • Support for HTTP and TCP (Netstring) JSON-RPC.

  • A jsonrpclib similar to the one for XLM-RPC offered by the Python standard library.

Dependencies

txJSON-RPC currently has the following dependencies:

Installation

Development

If you want to develop for txJSON-RPC or use the latest code we’re working on, you can install from the sources. You’ll need bzr installed, and then just do the following:

$ bzr branch lp:txjsonrpc
$ cd txjsonrpc
$ sudo python setup.py install

Easy Install

You can use the setuptools easy_install script to get txSpore on your system:

$ sudo easy_install txJSON-RPC

Manual Download

You can manually download the source tarball from the Python Package Index by visiting the following URL:

http://pypi.python.org/pypi/txJSON-RPC/

You’ll need to untar and gunzip the source, cd into the source directory, and then you can do the usual:

$ sudo python setup.py install

Checking the Source

Once installed, you can test the source code by executing this from the top-level source directory:

$ trial txjsonrpc

That will run the test suite and report on the success and failure of any unit tests.

Usage

Examples

In the top-level source directory for txJSON-RPC, there is an examples directory. This contains the following:

  • Client and server examples for twiste.web-based JSON-RPC.

  • Client and server examples for twiste.web2-based JSON-RPC.

  • Client and server examples for Netstring TCP JSON-RPC as well as code shoing how to use subhandlers for the TCP code, since this is different than the XML-RPC/JSON-RPC HTTP-based subhandlers.

Examining each of the Python files in the example directories is the best way to get a sense of how to use txJSON-RPC.

TODO

Known Issues

  • txJSON-RPC doesn’t yet support the proposed v2.0 JSON-RPC protocol.

JSON-RPC over TCP

  • pull out anything that has to do with setting the payload (e.g., method/params dict) and put it in jsonrpclib

  • clean up error checking, now that errors are going in the payload under the “error” key.

jsonrpclib

  • return results in simpljson dicts with possible keeys of “result” or “error”

  • use simplesjon’s hook for creating appropriate JS objects from hints in the results

Changes

txJSON-RPC 0.3.0

  • Removed unneeded dependency upon twisted.web2 for the TCP/Netstring JSON-RPC code.

  • Updated Netstring JSON-RPC code to allow for setting the MAX_LENGTH attribute.

  • Improved documentation.

txJSON-RPC 0.2.0

  • Added a datetime serializer.

txJSON-RPC 0.1.0

  • Bug fix from Moshe Zadka for SimpleParser and long replies.

txJSON-RPC 0.0.5

  • SimpleParser bug fix, improved code abstractions.

Twisted-JSONRPC 0.0.4

  • Changed name in accord with Twisted community projects recommendations.

Twisted-JSONRPC 0.0.3

  • Includes support for Twisted JSON-RPC servers/clients over TCP by means of the Netstring protocol.

Twisted-JSONRPC 0.0.2

  • Includes support for twisted.web2 JSON-RPC servers over HTTP.

Twisted-JSONRPC 0.0.1

  • Includes support for twisted.web JSON-RPC servers/clients over HTTP.

Project details


Download files

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

Source Distribution

txJSON-RPC-0.3.tar.gz (15.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page