Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-json-rpc for openSUSE:Factory 
checked in at 2023-01-07 17:19:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-json-rpc (Old)
 and      /work/SRC/openSUSE:Factory/.python-json-rpc.new.1563 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-json-rpc"

Sat Jan  7 17:19:54 2023 rev:6 rq:1056764 version:1.14.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-json-rpc/python-json-rpc.changes  
2022-03-24 22:57:57.980248558 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-json-rpc.new.1563/python-json-rpc.changes    
    2023-01-07 17:23:16.311429352 +0100
@@ -1,0 +2,7 @@
+Sat Jan  7 12:10:38 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 1.14.0 
+  * ADD: context arguments to dispatcher
+  * FIX: positional arguments support for Django backend
+
+-------------------------------------------------------------------
@@ -9 +16 @@
-- Update to 0.13.0:
+- Update to 1.13.0:

Old:
----
  json-rpc-1.13.0.tar.gz

New:
----
  json-rpc-1.14.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-json-rpc.spec ++++++
--- /var/tmp/diff_new_pack.kwDYMM/_old  2023-01-07 17:23:16.803432287 +0100
+++ /var/tmp/diff_new_pack.kwDYMM/_new  2023-01-07 17:23:16.811432335 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-json-rpc
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-json-rpc
-Version:        1.13.0
+Version:        1.14.0
 Release:        0
 Summary:        JSON-RPC transport implementation
 License:        MIT

++++++ json-rpc-1.13.0.tar.gz -> json-rpc-1.14.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/json-rpc-1.13.0/PKG-INFO new/json-rpc-1.14.0/PKG-INFO
--- old/json-rpc-1.13.0/PKG-INFO        2020-01-07 16:27:25.000000000 +0100
+++ new/json-rpc-1.14.0/PKG-INFO        2022-12-23 08:52:39.331370800 +0100
@@ -1,173 +1,11 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
 Name: json-rpc
-Version: 1.13.0
+Version: 1.14.0
 Summary: JSON-RPC transport implementation
 Home-page: https://github.com/pavlov99/json-rpc
 Author: Kirill Pavlov
 Author-email: [email protected]
 License: MIT
-Description: json-rpc
-        ========
-        
-        .. image:: 
https://circleci.com/gh/pavlov99/json-rpc/tree/master.svg?style=svg
-            :target: https://circleci.com/gh/pavlov99/json-rpc/tree/master
-            :alt: Build Status
-        
-        .. image:: 
https://codecov.io/gh/pavlov99/json-rpc/branch/master/graph/badge.svg
-            :target: https://codecov.io/gh/pavlov99/json-rpc
-            :alt: Coverage Status
-        
-        .. image:: 
https://readthedocs.org/projects/json-rpc/badge/?version=latest
-            :target: http://json-rpc.readthedocs.io/en/latest/?badge=latest
-        
-        .. image:: https://img.shields.io/pypi/v/json-rpc.svg
-            :target: https://pypi.org/project/json-rpc/
-            :alt: Latest PyPI version
-        
-        .. image:: https://img.shields.io/pypi/pyversions/json-rpc.svg
-            :target: https://pypi.org/project/json-rpc/
-            :alt: Supported Python versions
-        
-        .. image:: https://badges.gitter.im/pavlov99/json-rpc.svg
-            :target: https://gitter.im/pavlov99/json-rpc
-            :alt: Gitter
-        
-        
-        .. image:: 
https://opencollective.com/json-rpc/tiers/backer/badge.svg?label=backer&color=brightgreen
-            :target: https://opencollective.com/json-rpc
-            :alt: Bakers
-        
-        .. image:: 
https://opencollective.com/json-rpc/tiers/backer/badge.svg?label=sponsor&color=brightgreen
-            :target: https://opencollective.com/json-rpc
-            :alt: Sponsors
-        
-        `JSON-RPC2.0 <http://www.jsonrpc.org/specification>`_ and `JSON-RPC1.0 
<http://json-rpc.org/wiki/specification>`_ transport specification 
implementation.
-        Supports Python 2.6+, Python 3.3+, PyPy. Has optional Django and Flask 
support. 200+ tests.
-        
-        Features
-        --------
-        
-        This implementation does not have any transport functionality 
realization, only protocol.
-        Any client or server implementation is easy based on current code, but 
requires transport libraries, such as requests, gevent or zmq, see `examples 
<https://github.com/pavlov99/json-rpc/tree/master/examples>`_.
-        
-        - Vanilla Python, no dependencies.
-        - 200+ tests for multiple edge cases.
-        - Optional backend support for Django, Flask.
-        - json-rpc 1.1 and 2.0 support.
-        
-        Install
-        -------
-        
-        .. code-block:: python
-        
-            pip install json-rpc
-        
-        Tests
-        -----
-        
-        Quickstart
-        ^^^^^^^^^^
-        This is an essential part of the library as there are a lot of edge 
cases in JSON-RPC standard. To manage a variety of supported python versions as 
well as optional backends json-rpc uses `tox`:
-        
-        .. code-block:: bash
-        
-            tox
-        
-        .. TIP::
-           During local development use your python version with tox runner. 
For example, if your are using Python 3.6 run `tox -e py36`. It is easier to 
develop functionality for specific version first and then expands it to all of 
the supported versions.
-        
-        Continuous integration
-        ^^^^^^^^^^^^^^^^^^^^^^
-        This project uses `CircleCI <https://circleci.com/>`_ for continuous 
integration. All of the python supported versions are managed via `tox.ini` and 
`.circleci/config.yml` files. Master branch test status is displayed on the 
badge in the beginning of this document.
-        
-        Test matrix
-        ^^^^^^^^^^^
-        json-rpc supports multiple python versions: 2.6+, 3.3+, pypy. This 
introduces difficulties with testing libraries and optional dependencies 
management. For example, python before version 3.3 does not support `mock` and 
there is a limited support for `unittest2`. Every dependency translates into 
*if-then* blocks in the source code and adds complexity to it. Hence, while 
cross-python support is a core feature of this library, cross-Django or 
cross-Flask support is limited. In general, json-rpc uses latest stable release 
which supports current python version. For example, python 2.6 is compatible 
with Django 1.6 and not compatible with any future versions.
-        
-        Below is a testing matrix:
-        
-        +--------+-------+-----------+--------+--------+
-        | Python | mock  | unittest  | Django | Flask  |
-        +========+=======+===========+========+========+
-        | 2.6    | 2.0.0 | unittest2 | 1.6    | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | 2.7    | 2.0.0 |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | 3.3    |       |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | 3.4    |       |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | 3.5    |       |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | 3.6    |       |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | pypy   | 2.0.0 |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | pypy3  |       |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        
-        Quickstart
-        ----------
-        Server (uses `Werkzeug <http://werkzeug.pocoo.org/>`_)
-        
-        .. code-block:: python
-        
-            from werkzeug.wrappers import Request, Response
-            from werkzeug.serving import run_simple
-        
-            from jsonrpc import JSONRPCResponseManager, dispatcher
-        
-        
-            @dispatcher.add_method
-            def foobar(**kwargs):
-                return kwargs["foo"] + kwargs["bar"]
-        
-        
-            @Request.application
-            def application(request):
-                # Dispatcher is dictionary {<method_name>: callable}
-                dispatcher["echo"] = lambda s: s
-                dispatcher["add"] = lambda a, b: a + b
-        
-                response = JSONRPCResponseManager.handle(
-                    request.data, dispatcher)
-                return Response(response.json, mimetype='application/json')
-        
-        
-            if __name__ == '__main__':
-                run_simple('localhost', 4000, application)
-        
-        Client (uses `requests <http://www.python-requests.org/en/latest/>`_)
-        
-        .. code-block:: python
-        
-            import requests
-            import json
-        
-        
-            def main():
-                url = "http://localhost:4000/jsonrpc";
-        
-                # Example echo method
-                payload = {
-                    "method": "echo",
-                    "params": ["echome!"],
-                    "jsonrpc": "2.0",
-                    "id": 0,
-                }
-                response = requests.post(url, json=payload).json()
-        
-                assert response["result"] == "echome!"
-                assert response["jsonrpc"]
-                assert response["id"] == 0
-        
-            if __name__ == "__main__":
-                main()
-        
-        Competitors
-        -----------
-        There are `several libraries 
<http://en.wikipedia.org/wiki/JSON-RPC#Implementations>`_ implementing JSON-RPC 
protocol. List below represents python libraries, none of the supports python3. 
tinyrpc looks better than others.
-        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Console
@@ -184,3 +22,168 @@
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
+License-File: LICENSE.txt
+
+json-rpc
+========
+
+.. image:: https://circleci.com/gh/pavlov99/json-rpc/tree/master.svg?style=svg
+    :target: https://circleci.com/gh/pavlov99/json-rpc/tree/master
+    :alt: Build Status
+
+.. image:: 
https://codecov.io/gh/pavlov99/json-rpc/branch/master/graph/badge.svg
+    :target: https://codecov.io/gh/pavlov99/json-rpc
+    :alt: Coverage Status
+
+.. image:: https://readthedocs.org/projects/json-rpc/badge/?version=latest
+    :target: http://json-rpc.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/pypi/v/json-rpc.svg
+    :target: https://pypi.org/project/json-rpc/
+    :alt: Latest PyPI version
+
+.. image:: https://img.shields.io/pypi/pyversions/json-rpc.svg
+    :target: https://pypi.org/project/json-rpc/
+    :alt: Supported Python versions
+
+.. image:: https://badges.gitter.im/pavlov99/json-rpc.svg
+    :target: https://gitter.im/pavlov99/json-rpc
+    :alt: Gitter
+
+
+.. image:: 
https://opencollective.com/json-rpc/tiers/backer/badge.svg?label=backer&color=brightgreen
+    :target: https://opencollective.com/json-rpc
+    :alt: Bakers
+
+.. image:: 
https://opencollective.com/json-rpc/tiers/backer/badge.svg?label=sponsor&color=brightgreen
+    :target: https://opencollective.com/json-rpc
+    :alt: Sponsors
+
+`JSON-RPC2.0 <http://www.jsonrpc.org/specification>`_ and `JSON-RPC1.0 
<http://json-rpc.org/wiki/specification>`_ transport specification 
implementation.
+Supports Python 2.6+, Python 3.3+, PyPy. Has optional Django and Flask 
support. 200+ tests.
+
+Features
+--------
+
+This implementation does not have any transport functionality realization, 
only protocol.
+Any client or server implementation is easy based on current code, but 
requires transport libraries, such as requests, gevent or zmq, see `examples 
<https://github.com/pavlov99/json-rpc/tree/master/examples>`_.
+
+- Vanilla Python, no dependencies.
+- 200+ tests for multiple edge cases.
+- Optional backend support for Django, Flask.
+- json-rpc 1.1 and 2.0 support.
+
+Install
+-------
+
+.. code-block:: python
+
+    pip install json-rpc
+
+Tests
+-----
+
+Quickstart
+^^^^^^^^^^
+This is an essential part of the library as there are a lot of edge cases in 
JSON-RPC standard. To manage a variety of supported python versions as well as 
optional backends json-rpc uses `tox`:
+
+.. code-block:: bash
+
+    tox
+
+.. TIP::
+   During local development use your python version with tox runner. For 
example, if your are using Python 3.6 run `tox -e py36`. It is easier to 
develop functionality for specific version first and then expands it to all of 
the supported versions.
+
+Continuous integration
+^^^^^^^^^^^^^^^^^^^^^^
+This project uses `CircleCI <https://circleci.com/>`_ for continuous 
integration. All of the python supported versions are managed via `tox.ini` and 
`.circleci/config.yml` files. Master branch test status is displayed on the 
badge in the beginning of this document.
+
+Test matrix
+^^^^^^^^^^^
+json-rpc supports multiple python versions: 2.6+, 3.3+, pypy. This introduces 
difficulties with testing libraries and optional dependencies management. For 
example, python before version 3.3 does not support `mock` and there is a 
limited support for `unittest2`. Every dependency translates into *if-then* 
blocks in the source code and adds complexity to it. Hence, while cross-python 
support is a core feature of this library, cross-Django or cross-Flask support 
is limited. In general, json-rpc uses latest stable release which supports 
current python version. For example, python 2.6 is compatible with Django 1.6 
and not compatible with any future versions.
+
+Below is a testing matrix:
+
++--------+-------+-----------+--------+--------+
+| Python | mock  | unittest  | Django | Flask  |
++========+=======+===========+========+========+
+| 2.6    | 2.0.0 | unittest2 | 1.6    | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| 2.7    | 2.0.0 |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| 3.3    |       |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| 3.4    |       |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| 3.5    |       |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| 3.6    |       |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| pypy   | 2.0.0 |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| pypy3  |       |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+
+Quickstart
+----------
+Server (uses `Werkzeug <http://werkzeug.pocoo.org/>`_)
+
+.. code-block:: python
+
+    from werkzeug.wrappers import Request, Response
+    from werkzeug.serving import run_simple
+
+    from jsonrpc import JSONRPCResponseManager, dispatcher
+
+
+    @dispatcher.add_method
+    def foobar(**kwargs):
+        return kwargs["foo"] + kwargs["bar"]
+
+
+    @Request.application
+    def application(request):
+        # Dispatcher is dictionary {<method_name>: callable}
+        dispatcher["echo"] = lambda s: s
+        dispatcher["add"] = lambda a, b: a + b
+
+        response = JSONRPCResponseManager.handle(
+            request.data, dispatcher)
+        return Response(response.json, mimetype='application/json')
+
+
+    if __name__ == '__main__':
+        run_simple('localhost', 4000, application)
+
+Client (uses `requests <http://www.python-requests.org/en/latest/>`_)
+
+.. code-block:: python
+
+    import requests
+    import json
+
+
+    def main():
+        url = "http://localhost:4000/jsonrpc";
+
+        # Example echo method
+        payload = {
+            "method": "echo",
+            "params": ["echome!"],
+            "jsonrpc": "2.0",
+            "id": 0,
+        }
+        response = requests.post(url, json=payload).json()
+
+        assert response["result"] == "echome!"
+        assert response["jsonrpc"]
+        assert response["id"] == 0
+
+    if __name__ == "__main__":
+        main()
+
+Competitors
+-----------
+There are `several libraries 
<http://en.wikipedia.org/wiki/JSON-RPC#Implementations>`_ implementing JSON-RPC 
protocol. List below represents python libraries, none of the supports python3. 
tinyrpc looks better than others.
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/json-rpc-1.13.0/json_rpc.egg-info/PKG-INFO 
new/json-rpc-1.14.0/json_rpc.egg-info/PKG-INFO
--- old/json-rpc-1.13.0/json_rpc.egg-info/PKG-INFO      2020-01-07 
16:27:25.000000000 +0100
+++ new/json-rpc-1.14.0/json_rpc.egg-info/PKG-INFO      2022-12-23 
08:52:39.000000000 +0100
@@ -1,173 +1,11 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
 Name: json-rpc
-Version: 1.13.0
+Version: 1.14.0
 Summary: JSON-RPC transport implementation
 Home-page: https://github.com/pavlov99/json-rpc
 Author: Kirill Pavlov
 Author-email: [email protected]
 License: MIT
-Description: json-rpc
-        ========
-        
-        .. image:: 
https://circleci.com/gh/pavlov99/json-rpc/tree/master.svg?style=svg
-            :target: https://circleci.com/gh/pavlov99/json-rpc/tree/master
-            :alt: Build Status
-        
-        .. image:: 
https://codecov.io/gh/pavlov99/json-rpc/branch/master/graph/badge.svg
-            :target: https://codecov.io/gh/pavlov99/json-rpc
-            :alt: Coverage Status
-        
-        .. image:: 
https://readthedocs.org/projects/json-rpc/badge/?version=latest
-            :target: http://json-rpc.readthedocs.io/en/latest/?badge=latest
-        
-        .. image:: https://img.shields.io/pypi/v/json-rpc.svg
-            :target: https://pypi.org/project/json-rpc/
-            :alt: Latest PyPI version
-        
-        .. image:: https://img.shields.io/pypi/pyversions/json-rpc.svg
-            :target: https://pypi.org/project/json-rpc/
-            :alt: Supported Python versions
-        
-        .. image:: https://badges.gitter.im/pavlov99/json-rpc.svg
-            :target: https://gitter.im/pavlov99/json-rpc
-            :alt: Gitter
-        
-        
-        .. image:: 
https://opencollective.com/json-rpc/tiers/backer/badge.svg?label=backer&color=brightgreen
-            :target: https://opencollective.com/json-rpc
-            :alt: Bakers
-        
-        .. image:: 
https://opencollective.com/json-rpc/tiers/backer/badge.svg?label=sponsor&color=brightgreen
-            :target: https://opencollective.com/json-rpc
-            :alt: Sponsors
-        
-        `JSON-RPC2.0 <http://www.jsonrpc.org/specification>`_ and `JSON-RPC1.0 
<http://json-rpc.org/wiki/specification>`_ transport specification 
implementation.
-        Supports Python 2.6+, Python 3.3+, PyPy. Has optional Django and Flask 
support. 200+ tests.
-        
-        Features
-        --------
-        
-        This implementation does not have any transport functionality 
realization, only protocol.
-        Any client or server implementation is easy based on current code, but 
requires transport libraries, such as requests, gevent or zmq, see `examples 
<https://github.com/pavlov99/json-rpc/tree/master/examples>`_.
-        
-        - Vanilla Python, no dependencies.
-        - 200+ tests for multiple edge cases.
-        - Optional backend support for Django, Flask.
-        - json-rpc 1.1 and 2.0 support.
-        
-        Install
-        -------
-        
-        .. code-block:: python
-        
-            pip install json-rpc
-        
-        Tests
-        -----
-        
-        Quickstart
-        ^^^^^^^^^^
-        This is an essential part of the library as there are a lot of edge 
cases in JSON-RPC standard. To manage a variety of supported python versions as 
well as optional backends json-rpc uses `tox`:
-        
-        .. code-block:: bash
-        
-            tox
-        
-        .. TIP::
-           During local development use your python version with tox runner. 
For example, if your are using Python 3.6 run `tox -e py36`. It is easier to 
develop functionality for specific version first and then expands it to all of 
the supported versions.
-        
-        Continuous integration
-        ^^^^^^^^^^^^^^^^^^^^^^
-        This project uses `CircleCI <https://circleci.com/>`_ for continuous 
integration. All of the python supported versions are managed via `tox.ini` and 
`.circleci/config.yml` files. Master branch test status is displayed on the 
badge in the beginning of this document.
-        
-        Test matrix
-        ^^^^^^^^^^^
-        json-rpc supports multiple python versions: 2.6+, 3.3+, pypy. This 
introduces difficulties with testing libraries and optional dependencies 
management. For example, python before version 3.3 does not support `mock` and 
there is a limited support for `unittest2`. Every dependency translates into 
*if-then* blocks in the source code and adds complexity to it. Hence, while 
cross-python support is a core feature of this library, cross-Django or 
cross-Flask support is limited. In general, json-rpc uses latest stable release 
which supports current python version. For example, python 2.6 is compatible 
with Django 1.6 and not compatible with any future versions.
-        
-        Below is a testing matrix:
-        
-        +--------+-------+-----------+--------+--------+
-        | Python | mock  | unittest  | Django | Flask  |
-        +========+=======+===========+========+========+
-        | 2.6    | 2.0.0 | unittest2 | 1.6    | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | 2.7    | 2.0.0 |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | 3.3    |       |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | 3.4    |       |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | 3.5    |       |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | 3.6    |       |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | pypy   | 2.0.0 |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        | pypy3  |       |           | 1.11   | 0.12.2 |
-        +--------+-------+-----------+--------+--------+
-        
-        Quickstart
-        ----------
-        Server (uses `Werkzeug <http://werkzeug.pocoo.org/>`_)
-        
-        .. code-block:: python
-        
-            from werkzeug.wrappers import Request, Response
-            from werkzeug.serving import run_simple
-        
-            from jsonrpc import JSONRPCResponseManager, dispatcher
-        
-        
-            @dispatcher.add_method
-            def foobar(**kwargs):
-                return kwargs["foo"] + kwargs["bar"]
-        
-        
-            @Request.application
-            def application(request):
-                # Dispatcher is dictionary {<method_name>: callable}
-                dispatcher["echo"] = lambda s: s
-                dispatcher["add"] = lambda a, b: a + b
-        
-                response = JSONRPCResponseManager.handle(
-                    request.data, dispatcher)
-                return Response(response.json, mimetype='application/json')
-        
-        
-            if __name__ == '__main__':
-                run_simple('localhost', 4000, application)
-        
-        Client (uses `requests <http://www.python-requests.org/en/latest/>`_)
-        
-        .. code-block:: python
-        
-            import requests
-            import json
-        
-        
-            def main():
-                url = "http://localhost:4000/jsonrpc";
-        
-                # Example echo method
-                payload = {
-                    "method": "echo",
-                    "params": ["echome!"],
-                    "jsonrpc": "2.0",
-                    "id": 0,
-                }
-                response = requests.post(url, json=payload).json()
-        
-                assert response["result"] == "echome!"
-                assert response["jsonrpc"]
-                assert response["id"] == 0
-        
-            if __name__ == "__main__":
-                main()
-        
-        Competitors
-        -----------
-        There are `several libraries 
<http://en.wikipedia.org/wiki/JSON-RPC#Implementations>`_ implementing JSON-RPC 
protocol. List below represents python libraries, none of the supports python3. 
tinyrpc looks better than others.
-        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Console
@@ -184,3 +22,168 @@
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
+License-File: LICENSE.txt
+
+json-rpc
+========
+
+.. image:: https://circleci.com/gh/pavlov99/json-rpc/tree/master.svg?style=svg
+    :target: https://circleci.com/gh/pavlov99/json-rpc/tree/master
+    :alt: Build Status
+
+.. image:: 
https://codecov.io/gh/pavlov99/json-rpc/branch/master/graph/badge.svg
+    :target: https://codecov.io/gh/pavlov99/json-rpc
+    :alt: Coverage Status
+
+.. image:: https://readthedocs.org/projects/json-rpc/badge/?version=latest
+    :target: http://json-rpc.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/pypi/v/json-rpc.svg
+    :target: https://pypi.org/project/json-rpc/
+    :alt: Latest PyPI version
+
+.. image:: https://img.shields.io/pypi/pyversions/json-rpc.svg
+    :target: https://pypi.org/project/json-rpc/
+    :alt: Supported Python versions
+
+.. image:: https://badges.gitter.im/pavlov99/json-rpc.svg
+    :target: https://gitter.im/pavlov99/json-rpc
+    :alt: Gitter
+
+
+.. image:: 
https://opencollective.com/json-rpc/tiers/backer/badge.svg?label=backer&color=brightgreen
+    :target: https://opencollective.com/json-rpc
+    :alt: Bakers
+
+.. image:: 
https://opencollective.com/json-rpc/tiers/backer/badge.svg?label=sponsor&color=brightgreen
+    :target: https://opencollective.com/json-rpc
+    :alt: Sponsors
+
+`JSON-RPC2.0 <http://www.jsonrpc.org/specification>`_ and `JSON-RPC1.0 
<http://json-rpc.org/wiki/specification>`_ transport specification 
implementation.
+Supports Python 2.6+, Python 3.3+, PyPy. Has optional Django and Flask 
support. 200+ tests.
+
+Features
+--------
+
+This implementation does not have any transport functionality realization, 
only protocol.
+Any client or server implementation is easy based on current code, but 
requires transport libraries, such as requests, gevent or zmq, see `examples 
<https://github.com/pavlov99/json-rpc/tree/master/examples>`_.
+
+- Vanilla Python, no dependencies.
+- 200+ tests for multiple edge cases.
+- Optional backend support for Django, Flask.
+- json-rpc 1.1 and 2.0 support.
+
+Install
+-------
+
+.. code-block:: python
+
+    pip install json-rpc
+
+Tests
+-----
+
+Quickstart
+^^^^^^^^^^
+This is an essential part of the library as there are a lot of edge cases in 
JSON-RPC standard. To manage a variety of supported python versions as well as 
optional backends json-rpc uses `tox`:
+
+.. code-block:: bash
+
+    tox
+
+.. TIP::
+   During local development use your python version with tox runner. For 
example, if your are using Python 3.6 run `tox -e py36`. It is easier to 
develop functionality for specific version first and then expands it to all of 
the supported versions.
+
+Continuous integration
+^^^^^^^^^^^^^^^^^^^^^^
+This project uses `CircleCI <https://circleci.com/>`_ for continuous 
integration. All of the python supported versions are managed via `tox.ini` and 
`.circleci/config.yml` files. Master branch test status is displayed on the 
badge in the beginning of this document.
+
+Test matrix
+^^^^^^^^^^^
+json-rpc supports multiple python versions: 2.6+, 3.3+, pypy. This introduces 
difficulties with testing libraries and optional dependencies management. For 
example, python before version 3.3 does not support `mock` and there is a 
limited support for `unittest2`. Every dependency translates into *if-then* 
blocks in the source code and adds complexity to it. Hence, while cross-python 
support is a core feature of this library, cross-Django or cross-Flask support 
is limited. In general, json-rpc uses latest stable release which supports 
current python version. For example, python 2.6 is compatible with Django 1.6 
and not compatible with any future versions.
+
+Below is a testing matrix:
+
++--------+-------+-----------+--------+--------+
+| Python | mock  | unittest  | Django | Flask  |
++========+=======+===========+========+========+
+| 2.6    | 2.0.0 | unittest2 | 1.6    | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| 2.7    | 2.0.0 |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| 3.3    |       |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| 3.4    |       |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| 3.5    |       |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| 3.6    |       |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| pypy   | 2.0.0 |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+| pypy3  |       |           | 1.11   | 0.12.2 |
++--------+-------+-----------+--------+--------+
+
+Quickstart
+----------
+Server (uses `Werkzeug <http://werkzeug.pocoo.org/>`_)
+
+.. code-block:: python
+
+    from werkzeug.wrappers import Request, Response
+    from werkzeug.serving import run_simple
+
+    from jsonrpc import JSONRPCResponseManager, dispatcher
+
+
+    @dispatcher.add_method
+    def foobar(**kwargs):
+        return kwargs["foo"] + kwargs["bar"]
+
+
+    @Request.application
+    def application(request):
+        # Dispatcher is dictionary {<method_name>: callable}
+        dispatcher["echo"] = lambda s: s
+        dispatcher["add"] = lambda a, b: a + b
+
+        response = JSONRPCResponseManager.handle(
+            request.data, dispatcher)
+        return Response(response.json, mimetype='application/json')
+
+
+    if __name__ == '__main__':
+        run_simple('localhost', 4000, application)
+
+Client (uses `requests <http://www.python-requests.org/en/latest/>`_)
+
+.. code-block:: python
+
+    import requests
+    import json
+
+
+    def main():
+        url = "http://localhost:4000/jsonrpc";
+
+        # Example echo method
+        payload = {
+            "method": "echo",
+            "params": ["echome!"],
+            "jsonrpc": "2.0",
+            "id": 0,
+        }
+        response = requests.post(url, json=payload).json()
+
+        assert response["result"] == "echome!"
+        assert response["jsonrpc"]
+        assert response["id"] == 0
+
+    if __name__ == "__main__":
+        main()
+
+Competitors
+-----------
+There are `several libraries 
<http://en.wikipedia.org/wiki/JSON-RPC#Implementations>`_ implementing JSON-RPC 
protocol. List below represents python libraries, none of the supports python3. 
tinyrpc looks better than others.
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/json-rpc-1.13.0/jsonrpc/__init__.py 
new/json-rpc-1.14.0/jsonrpc/__init__.py
--- old/json-rpc-1.13.0/jsonrpc/__init__.py     2020-01-07 16:17:43.000000000 
+0100
+++ new/json-rpc-1.14.0/jsonrpc/__init__.py     2022-12-23 08:43:33.000000000 
+0100
@@ -1,7 +1,7 @@
 from .manager import JSONRPCResponseManager
 from .dispatcher import Dispatcher
 
-__version = (1, 13, 0)
+__version = (1, 14, 0)
 
 __version__ = version = '.'.join(map(str, __version))
 __project__ = PROJECT = __name__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/json-rpc-1.13.0/jsonrpc/backend/django.py 
new/json-rpc-1.14.0/jsonrpc/backend/django.py
--- old/json-rpc-1.13.0/jsonrpc/backend/django.py       2019-11-18 
16:55:59.000000000 +0100
+++ new/json-rpc-1.14.0/jsonrpc/backend/django.py       2022-12-23 
07:59:25.000000000 +0100
@@ -4,7 +4,6 @@
 from django.conf.urls import url
 from django.conf import settings
 from django.http import HttpResponse, HttpResponseNotAllowed
-import copy
 import json
 import logging
 import time
@@ -45,6 +44,14 @@
     @csrf_exempt
     def jsonrpc(self, request):
         """ JSON-RPC 2.0 handler."""
+
+        def inject_request(jsonrpc_request):
+            jsonrpc_request.params = jsonrpc_request.params or {}
+            if isinstance(jsonrpc_request.params, dict):
+                jsonrpc_request.params.update(request=request)
+            if isinstance(jsonrpc_request.params, list):
+                jsonrpc_request.params.insert(0, request)
+
         if request.method != "POST":
             return HttpResponseNotAllowed(["POST"])
 
@@ -55,19 +62,12 @@
             response = JSONRPCResponseManager.handle(
                 request_str, self.dispatcher)
         else:
-            jsonrpc_request.params = jsonrpc_request.params or {}
-            jsonrpc_request_params = copy.copy(jsonrpc_request.params)
-            if isinstance(jsonrpc_request.params, dict):
-                jsonrpc_request.params.update(request=request)
-            if isinstance(jsonrpc_request.params, list):
-                jsonrpc_request.params.insert(0, request)
+            requests = getattr(jsonrpc_request, 'requests', [jsonrpc_request])
+            for jsonrpc_req in requests:
+                inject_request(jsonrpc_req)
 
-            t1 = time.time()
             response = JSONRPCResponseManager.handle_request(
                 jsonrpc_request, self.dispatcher)
-            t2 = time.time()
-            logger.info('{0}({1}) {2:.2f} sec'.format(
-                jsonrpc_request.method, jsonrpc_request_params, t2 - t1))
 
         if response:
             response.serialize = response_serialize
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/json-rpc-1.13.0/jsonrpc/dispatcher.py 
new/json-rpc-1.14.0/jsonrpc/dispatcher.py
--- old/json-rpc-1.13.0/jsonrpc/dispatcher.py   2019-11-18 16:52:06.000000000 
+0100
+++ new/json-rpc-1.14.0/jsonrpc/dispatcher.py   2022-12-23 08:21:40.000000000 
+0100
@@ -32,6 +32,7 @@
 
         """
         self.method_map = dict()
+        self.context_arg_for_method = dict()
 
         if prototype is not None:
             self.build_method_map(prototype)
@@ -44,6 +45,7 @@
 
     def __delitem__(self, key):
         del self.method_map[key]
+        self.context_arg_for_method.pop(key, None)
 
     def __len__(self):
         return len(self.method_map)
@@ -67,7 +69,7 @@
             prefix += '.'
         self.build_method_map(dict, prefix)
 
-    def add_method(self, f=None, name=None):
+    def add_method(self, f=None, name=None, context_arg=None):
         """ Add a method to the dispatcher.
 
         Parameters
@@ -76,6 +78,9 @@
             Callable to be added.
         name : str, optional
             Name to register (the default is function **f** name)
+        context_arg : str, optional
+            Name to specify the function's argument which will receive
+            context data
 
         Notes
         -----
@@ -103,11 +108,22 @@
             def mymethod(*args, **kwargs):
                 print(args, kwargs)
 
-        """
-        if name and not f:
-            return functools.partial(self.add_method, name=name)
+        Or use as a decorator that specifies a context argument name (used by
+        JSONRPCResponseManager to add optional context to the method call)
+        >>> d = Dispatcher()
+        >>> @d.add_method(context_arg="context")
+            def mymethod(context):
+                print(context)
 
-        self.method_map[name or f.__name__] = f
+        """
+        if (name or context_arg) and not f:
+            return functools.partial(self.add_method, name=name,
+                                     context_arg=context_arg)
+
+        name = name or f.__name__
+        self.method_map[name] = f
+        if context_arg:
+            self.context_arg_for_method[name] = context_arg
         return f
 
     def build_method_map(self, prototype, prefix=''):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/json-rpc-1.13.0/jsonrpc/manager.py 
new/json-rpc-1.14.0/jsonrpc/manager.py
--- old/json-rpc-1.13.0/jsonrpc/manager.py      2018-12-30 05:21:46.000000000 
+0100
+++ new/json-rpc-1.14.0/jsonrpc/manager.py      2022-12-23 08:21:07.000000000 
+0100
@@ -42,7 +42,7 @@
     }
 
     @classmethod
-    def handle(cls, request_str, dispatcher):
+    def handle(cls, request_str, dispatcher, context=None):
         if isinstance(request_str, bytes):
             request_str = request_str.decode("utf-8")
 
@@ -56,10 +56,10 @@
         except JSONRPCInvalidRequestException:
             return JSONRPC20Response(error=JSONRPCInvalidRequest()._data)
 
-        return cls.handle_request(request, dispatcher)
+        return cls.handle_request(request, dispatcher, context)
 
     @classmethod
-    def handle_request(cls, request, dispatcher):
+    def handle_request(cls, request, dispatcher, context=None):
         """ Handle request data.
 
         At this moment request has correct jsonrpc format.
@@ -72,7 +72,7 @@
         """
         rs = request if isinstance(request, JSONRPC20BatchRequest) \
             else [request]
-        responses = [r for r in cls._get_responses(rs, dispatcher)
+        responses = [r for r in cls._get_responses(rs, dispatcher, context)
                      if r is not None]
 
         # notifications
@@ -87,7 +87,7 @@
             return responses[0]
 
     @classmethod
-    def _get_responses(cls, requests, dispatcher):
+    def _get_responses(cls, requests, dispatcher, context=None):
         """ Response to each single JSON-RPC Request.
 
         :return iterator(JSONRPC20Response):
@@ -110,7 +110,14 @@
                 output = make_response(error=JSONRPCMethodNotFound()._data)
             else:
                 try:
-                    result = method(*request.args, **request.kwargs)
+                    kwargs = request.kwargs
+                    if context is not None:
+                        context_arg = dispatcher.context_arg_for_method.get(
+                            request.method)
+                        if context_arg:
+                            context["request"] = request
+                            kwargs[context_arg] = context
+                    result = method(*request.args, **kwargs)
                 except JSONRPCDispatchException as e:
                     output = make_response(error=e.error._data)
                 except Exception as e:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/json-rpc-1.13.0/jsonrpc/tests/test_backend_django/test_backend.py 
new/json-rpc-1.14.0/jsonrpc/tests/test_backend_django/test_backend.py
--- old/json-rpc-1.13.0/jsonrpc/tests/test_backend_django/test_backend.py       
2019-11-18 16:55:59.000000000 +0100
+++ new/json-rpc-1.14.0/jsonrpc/tests/test_backend_django/test_backend.py       
2022-12-23 07:59:25.000000000 +0100
@@ -107,3 +107,29 @@
         custom_api = JSONRPCAPI(custom_dispatcher)
         self.assertEqual(type(custom_api.dispatcher), SubDispatcher)
         self.assertEqual(id(custom_api.dispatcher), id(custom_dispatcher))
+
+    def test_batch_request(self):
+        @api.dispatcher.add_method
+        def upper(request, name):
+            return name.upper()
+
+        json_data = [{
+            "id": "0",
+            "jsonrpc": "2.0",
+            "method": "upper",
+            "params": ["hello"],
+        }, {
+            "id": "1",
+            "jsonrpc": "2.0",
+            "method": "upper",
+            "params": ["world"],
+        }]
+        response = self.client.post(
+            '',
+            json.dumps(json_data),
+            content_type='application/json',
+        )
+        self.assertEqual(response.status_code, 200)
+        data = json.loads(response.content.decode('utf8'))
+        self.assertEqual(len(data), len(json_data))
+        self.assertEqual(data[0]['result'], json_data[0]['params'][0].upper())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/json-rpc-1.13.0/jsonrpc/tests/test_dispatcher.py 
new/json-rpc-1.14.0/jsonrpc/tests/test_dispatcher.py
--- old/json-rpc-1.13.0/jsonrpc/tests/test_dispatcher.py        2019-01-12 
10:59:15.000000000 +0100
+++ new/json-rpc-1.14.0/jsonrpc/tests/test_dispatcher.py        2022-12-23 
08:17:00.000000000 +0100
@@ -54,6 +54,15 @@
         self.assertIn("this.add", d)
         self.assertEqual(d["this.add"](1, 1), 2)
 
+    def test_add_method_with_context(self):
+        d = Dispatcher()
+
+        @d.add_method(context_arg="context")
+        def x_plus_id(x, context):
+            return x + context["id"]
+
+        self.assertEqual(d.context_arg_for_method["x_plus_id"], "context")
+
     def test_add_class(self):
         d = Dispatcher()
         d.add_class(Math)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/json-rpc-1.13.0/jsonrpc/tests/test_manager.py 
new/json-rpc-1.14.0/jsonrpc/tests/test_manager.py
--- old/json-rpc-1.13.0/jsonrpc/tests/test_manager.py   2019-11-18 
16:52:06.000000000 +0100
+++ new/json-rpc-1.14.0/jsonrpc/tests/test_manager.py   2022-12-23 
08:20:27.000000000 +0100
@@ -1,5 +1,6 @@
 import sys
 
+from ..dispatcher import Dispatcher
 from ..manager import JSONRPCResponseManager
 from ..jsonrpc2 import (
     JSONRPC20BatchRequest,
@@ -27,18 +28,23 @@
             raise e
 
         self.long_time_method = MagicMock()
-        self.dispatcher = {
-            "add": sum,
-            "multiply": lambda a, b: a * b,
-            "list_len": len,
-            "101_base": lambda **kwargs: int("101", **kwargs),
-            "error": lambda: raise_(KeyError("error_explanation")),
-            "type_error": lambda: raise_(TypeError("TypeError inside method")),
-            "long_time_method": self.long_time_method,
-            "dispatch_error": lambda x: raise_(
-                JSONRPCDispatchException(code=4000, message="error",
-                                         data={"param": 1})),
-        }
+        self.dispatcher = Dispatcher()
+        self.dispatcher["add"] = sum
+        self.dispatcher["multiply"] = lambda a, b: a * b
+        self.dispatcher["list_len"] = len
+        self.dispatcher["101_base"] = lambda **kwargs: int("101", **kwargs)
+        self.dispatcher["error"] = lambda: raise_(
+            KeyError("error_explanation"))
+        self.dispatcher["type_error"] = lambda: raise_(
+            TypeError("TypeError inside method"))
+        self.dispatcher["long_time_method"] = self.long_time_method
+        self.dispatcher["dispatch_error"] = lambda x: raise_(
+            JSONRPCDispatchException(code=4000, message="error",
+                                     data={"param": 1}))
+
+        @self.dispatcher.add_method(context_arg="context")
+        def return_json_rpc_id(context):
+            return context["request"]._id
 
     def test_dispatch_error(self):
         request = JSONRPC20Request("dispatch_error", ["test"], _id=0)
@@ -174,3 +180,9 @@
         self.assertTrue(isinstance(response, JSONRPC20Response))
         self.assertEqual(response.error["message"], "Invalid params")
         self.assertEqual(response.error["code"], -32602)
+
+    def test_setting_json_rpc_id_in_context(self):
+        request = JSONRPC20Request("return_json_rpc_id", _id=42)
+        response = JSONRPCResponseManager.handle(request.json, self.dispatcher,
+                                                 context={})
+        self.assertEqual(response.data["result"], 42)

Reply via email to