txjsonrpc-ng
Introduction
txjsonrpc-ng is an asynchronous JSON-RPC library for Python built on Twisted. It allows you to create async Python JSON-RPC servers and clients either over HTTP or directly on TCP with the Netstring protocol.
Features
🚀 Asynchronous: Built on Twisted for high-performance async I/O
🌐 Multiple Transports: HTTP and TCP (Netstring) support
📋 Protocol Versions: Supports JSON-RPC pre-1.0, 1.0, and 2.0
🔒 Authentication: Built-in authentication support
🔍 Introspection: Built-in method introspection (listMethods, methodHelp, methodSignature)
📚 jsonrpclib: Similar to Python’s xmlrpclib for easy migration
Installation
Install from PyPI using pip:
pip install txjsonrpc-ng
Or using Poetry:
poetry add txjsonrpc-ng
Requirements:
Python 3.10 or higher
Twisted 25.5 or higher
Quick Start
Server Example (HTTP)
from twisted.web import server
from twisted.internet import reactor
from txjsonrpc_ng.web.jsonrpc import Handler
class ExampleHandler(Handler):
def jsonrpc_echo(self, message):
"""Echo the message back"""
return message
def jsonrpc_add(self, a, b):
"""Add two numbers"""
return a + b
if __name__ == '__main__':
r = ExampleHandler()
reactor.listenTCP(8080, server.Site(r))
print("JSON-RPC server running on http://localhost:8080/")
reactor.run()
Client Example (HTTP)
from twisted.internet import reactor
from txjsonrpc_ng.web.jsonrpc import Proxy
def printResult(result):
print("Result:", result)
reactor.stop()
def printError(error):
print("Error:", error)
reactor.stop()
if __name__ == '__main__':
proxy = Proxy('http://localhost:8080/')
d = proxy.callRemote('add', 5, 3)
d.addCallback(printResult)
d.addErrback(printError)
reactor.run()
Examples
More examples are available in the examples/ directory:
examples/web/ - HTTP-based JSON-RPC
examples/tcp/ - TCP/Netstring-based JSON-RPC
examples/ssl/ - SSL-secured JSON-RPC
examples/webAuth/ - Authenticated JSON-RPC
Documentation
Installation: See docs/INSTALL.md
Usage Guide: See docs/USAGE.md
Specifications: See docs/specs/ for JSON-RPC protocol versions
Contributing: See CONTRIBUTING.md
Security: See SECURITY.md
License
txjsonrpc-ng is licensed under the MIT License. See LICENSE for details.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Support
Issues: GitHub Issues
Source: GitHub Repository
Metadata
Release files for txjsonrpc-ng 0.9.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| txjsonrpc_ng-0.9.2.tar.gz | 15.9 kB | Without provenance | Details for txjsonrpc_ng-0.9.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| txjsonrpc_ng-0.9.2-py3-none-any.whl | Python 3 | none | any | Details for txjsonrpc_ng-0.9.2-py3-none-any.whl |
Total release size: 35.0 kB
Release files / txjsonrpc_ng-0.9.2.tar.gz
| Download URL | txjsonrpc_ng-0.9.2.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6446a145877050180a7de047a9aaa18769e67b56f81cb5ead6fa0a057824bf21
|
|
BLAKE2b-256 checksum How to use checksums |
8de0968a5c25e51c69db6fce29e4af84120db7b5a6d7e0ef1f4027d4fd7d79dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.3 CPython/3.14.7 Darwin/27.0.0
|
Release files / txjsonrpc_ng-0.9.2-py3-none-any.whl
| Download URL | txjsonrpc_ng-0.9.2-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4d5983d6ae170cb9fb87a2b65e95ef4c582dcbadcc46e56ebc14e5058c762ec
|
|
BLAKE2b-256 checksum How to use checksums |
96adaf7cb8e5f69d66a83e35a5679ac0aa1b88fccba5ec5515b83a54f1639899
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.3 CPython/3.14.7 Darwin/27.0.0
|
Security for txjsonrpc-ng 0.9.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.