This commit is contained in:
2024-03-31 20:32:27 +03:00
parent ab33ba3763
commit fe25cd402c
5 changed files with 18 additions and 9 deletions

View File

@@ -5,16 +5,17 @@
You can adapt this file completely to your liking, but it should at least You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive. contain the root `toctree` directive.
Welcome to JSON-RPC's documentation! Документация JSON-RPC!
==================================== ======================
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
:caption: Contents: :caption: Содержание:
description description
install install
usage usage
backend/index
specification specification
Indices and tables Indices and tables

View File

@@ -6,7 +6,7 @@
.. code-block:: bash .. code-block:: bash
./setup.py sdist python -m build
Установка Установка
--------- ---------

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "jsonrpc" name = "jsonrpc"
version = "0.3.2" version = "1.0"
authors = [ authors = [
{ name="RemiZOffAlex", email="remizoffalex@gmail.com" }, { name="RemiZOffAlex", email="remizoffalex@gmail.com" },
] ]
@@ -10,4 +10,12 @@ maintainers = [
description = "" description = ""
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.10"
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12"
]
keywords = ["api", "json", "json-rpc", "rpc"] keywords = ["api", "json", "json-rpc", "rpc"]

View File

@@ -36,8 +36,8 @@ class Method:
params = None params = None
if 'params' in query: if 'params' in query:
params = query['params'] params = query['params']
if self.debug: if self.debug:
log.error(params) log.error(params)
if isinstance(self.pre, list): if isinstance(self.pre, list):
for item in self.pre: for item in self.pre:
item(query) item(query)

View File

@@ -34,7 +34,7 @@ class APIView(MethodView):
): ):
self.jsonrpc = jsonrpc self.jsonrpc = jsonrpc
self.debug = debug self.debug = debug
if debug: if self.debug:
log.debug('Connect JSON-RPC to Flask complete') log.debug('Connect JSON-RPC to Flask complete')
def get(self): def get(self):
@@ -45,6 +45,6 @@ class APIView(MethodView):
def post(self): def post(self):
json_data = to_json(request.data) json_data = to_json(request.data)
result = self.jsonrpc(json_data) result = self.jsonrpc(json_data)
if debug: if self.debug:
log.debug(result) log.debug(result)
return jsonify(result) return jsonify(result)