Jsonrpc Python Client Generator
Project description
Jsonrpc Python Client Generator
Installation
pip install jsonrpc-python-client-generator
Getting started
Create file generate.py
with code:
import sys, os
from jsonrpc_python_client_generator.generator import ClientGenerator
openRpcFile = '';
clientFile = '';
for i in range(len(sys.argv)):
if sys.argv[i] == "--schema":
openRpcFile = sys.argv[(i+1)]
if sys.argv[i] == "--output":
clientFile = sys.argv[(i+1)]
if (os.path.isfile(clientFile)):
raise SystemExit("Output file is already exists: " + clientFile)
if (os.path.isfile(openRpcFile) == False):
raise SystemExit("OpenRpc file does not exist: " + openRpcFile)
with open(openRpcFile) as f: schema = f.read()
generator = ClientGenerator(schema=schema,output=os.path.abspath(clientFile))
generator.run()
Than run script from command line:
python ./generate.py --output ./output/client.py --schema ./schema/onenrpc.json
where:
- --schema is path to OpenRPC schema file
- --output is output file
How to use client class
Put output file with client class in your project. Make import and than use the instance of this class. For example:
from client import JsonRpcClient
client = JsonRpcClient()
client.checkLogin(login="your_login")
Requirements
- Python 3.10 and higher
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
Built Distribution
Close
Hashes for jsonrpc_python_client_generator-1.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11f49171370ab5db1077f239e8d0029cf69988c197783d351edff37823c677eb |
|
MD5 | 0549bb36cd0209c9928d154a261af32c |
|
BLAKE2b-256 | 1d0952242164ae0f9afb130f96d3b06c957f3b5c918c1d6688fd3b864bf241d6 |
Close
Hashes for jsonrpc_python_client_generator-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10d281294cd367eef38e8d8f53848df8927bb2bf57da473222988fb8d5d87ab3 |
|
MD5 | a79954248f71e0a3b974f043858919c7 |
|
BLAKE2b-256 | d841e5893b70f4a520e0b23b40619f2c5729a48f5cee4330161bc5317e4f972b |