Skip to main content

JsonRpcExtended Logo

JsonRpcExtended

Description

A remote procedure call (RPC) framework based on JSON-RPC, extended to support alternative data formats and structures such as CSV, XML, binary and python calls.

Requirements

This package require:

  • python3
  • python3 Standard Library
  • PegParser

Installation

Pip

python3 -m pip install JsonRpcExtended

Git

git clone "https://github.com/mauricelambert/JsonRpcExtended.git"
cd "JsonRpcExtended"
python3 -m pip install .

Wget

wget https://github.com/mauricelambert/JsonRpcExtended/archive/refs/heads/main.zip
unzip main.zip
cd JsonRpcExtended-main
python3 -m pip install .

cURL

curl -O https://github.com/mauricelambert/JsonRpcExtended/archive/refs/heads/main.zip
unzip main.zip
cd JsonRpcExtended-main
python3 -m pip install .

Usages

Python script

from JsonRpcExtended import *
from asyncio import run

server = AsyncServer("127.0.0.1", 8520)
run(server.start())
from JsonRpcExtended import *
import socket

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server:
    server.bind(("127.0.0.1", 8520))
    server.listen()
    conn, addr = server.accept()
    with conn:
        while True:
            first_byte = conn.recv(1)
            protocol = get_rpc_format(first_byte)

            if FORMATS.BINARY == protocol:
                data = conn.recv(1024)
            elif FORMATS.JSON == protocol:
                file = conn.makefile(mode='rwb')
                data = file.readline()
            elif FORMATS.CSV == protocol:
                file = conn.makefile(mode='rwb')
                data = file.readline() + file.readline()
            elif FORMATS.XML == protocol:
                raise NotImplementedError("XML parsing is not implemented yet")

            response = loading_classes[protocol].handle_request_data(first_byte + data, conn.recv)
            conn.sendall(response)

Links

License

Licensed under the GPL, version 3.

Metadata

Release files for JsonRpcExtended 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for JsonRpcExtended 0.0.1
File Size Uploaded
jsonrpcextended-0.0.1.tar.gz 30.3 kB Details

Release files / jsonrpcextended-0.0.1.tar.gz

Download URL jsonrpcextended-0.0.1.tar.gz
Size 30.3 kB
Tags Source
SHA-256 checksum
How to use checksums
16fbc401ea266a923d50e4fa7cf74424a39127fb8474b3384588372cf25a48ee
BLAKE2b-256 checksum
How to use checksums
51cdd7c884bd1cc657fdd285931091779bfc9cc0170bc47dc5807ced7666d047
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page