# Jsonrpc Python Client Generator
## Installation
```bash
pip install jsonrpc-python-client-generator
```
## Getting started
Create file `generate.py` with code:
```python
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:
```bash
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:
```pyton
from client import JsonRpcClient
client = JsonRpcClient()
client.checkLogin(login="your_login")
```
## Requirements
* Python 3.10 and higher
Raw data
{
"_id": null,
"home_page": "https://github.com/vk1511work/jsonrpc-python-client-generator",
"name": "jsonrpc-python-client-generator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "jsonrpc 2.0 python client generator",
"author": "vk1511work",
"author_email": "vk1511work@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1d/09/52242164ae0f9afb130f96d3b06c957f3b5c918c1d6688fd3b864bf241d6/jsonrpc_python_client_generator-1.0.3.tar.gz",
"platform": null,
"description": "# Jsonrpc Python Client Generator\n\n## Installation\n\n```bash\npip install jsonrpc-python-client-generator\n```\n\n## Getting started\n\nCreate file `generate.py` with code:\n```python\nimport sys, os\n\nfrom jsonrpc_python_client_generator.generator import ClientGenerator\n\nopenRpcFile = '';\nclientFile = '';\n\nfor i in range(len(sys.argv)):\n if sys.argv[i] == \"--schema\":\n openRpcFile = sys.argv[(i+1)]\n if sys.argv[i] == \"--output\":\n clientFile = sys.argv[(i+1)]\n\nif (os.path.isfile(clientFile)):\n raise SystemExit(\"Output file is already exists: \" + clientFile)\n\nif (os.path.isfile(openRpcFile) == False):\n raise SystemExit(\"OpenRpc file does not exist: \" + openRpcFile)\n\nwith open(openRpcFile) as f: schema = f.read()\n\ngenerator = ClientGenerator(schema=schema,output=os.path.abspath(clientFile))\ngenerator.run()\n```\n\nThan run script from command line:\n```bash\npython ./generate.py --output ./output/client.py --schema ./schema/onenrpc.json \n```\nwhere:\n * --schema is path to OpenRPC schema file\n * --output is output file\n\n ## How to use client class\n\nPut output file with client class in your project. Make import and than use the instance of this class.\nFor example:\n```pyton\nfrom client import JsonRpcClient\n\nclient = JsonRpcClient()\nclient.checkLogin(login=\"your_login\")\n```\n\n## Requirements\n * Python 3.10 and higher\n",
"bugtrack_url": null,
"license": null,
"summary": "Jsonrpc Python Client Generator",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/vk1511work/jsonrpc-python-client-generator"
},
"split_keywords": [
"jsonrpc",
"2.0",
"python",
"client",
"generator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d841e5893b70f4a520e0b23b40619f2c5729a48f5cee4330161bc5317e4f972b",
"md5": "a79954248f71e0a3b974f043858919c7",
"sha256": "10d281294cd367eef38e8d8f53848df8927bb2bf57da473222988fb8d5d87ab3"
},
"downloads": -1,
"filename": "jsonrpc_python_client_generator-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a79954248f71e0a3b974f043858919c7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5564,
"upload_time": "2024-04-22T12:18:50",
"upload_time_iso_8601": "2024-04-22T12:18:50.073602Z",
"url": "https://files.pythonhosted.org/packages/d8/41/e5893b70f4a520e0b23b40619f2c5729a48f5cee4330161bc5317e4f972b/jsonrpc_python_client_generator-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1d0952242164ae0f9afb130f96d3b06c957f3b5c918c1d6688fd3b864bf241d6",
"md5": "0549bb36cd0209c9928d154a261af32c",
"sha256": "11f49171370ab5db1077f239e8d0029cf69988c197783d351edff37823c677eb"
},
"downloads": -1,
"filename": "jsonrpc_python_client_generator-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "0549bb36cd0209c9928d154a261af32c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4456,
"upload_time": "2024-04-22T12:18:51",
"upload_time_iso_8601": "2024-04-22T12:18:51.311333Z",
"url": "https://files.pythonhosted.org/packages/1d/09/52242164ae0f9afb130f96d3b06c957f3b5c918c1d6688fd3b864bf241d6/jsonrpc_python_client_generator-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-22 12:18:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vk1511work",
"github_project": "jsonrpc-python-client-generator",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jsonrpc-python-client-generator"
}