add jsonrpc to stdlib "Internet Protocols and Support" akin to xmlrpc
Hi I am new to this mailing list, hopefully this idea hasn't been raised already - I searched the PEPs and python-ideas and couldn't find anything similar, so decided to post this idea. Please forgive me if it is a duplicate. Idea: add jsonprc server and client to stdlib "Internet Protocols and Support" Details I would like to suggest adding a jsonrpc server and client to the stdlib "Internet Protocols and Support" with identical functionality to the existing xmlrpc.server and client but using json instead of xml, including a subclass SimpleJSONRPCServer just like SimpleXMLRPCServer based on socketserver.TCPServer. Rationale JSON is a very common data encoding format, widely established and very close to python's dictionaries, yet there exists today no jsonrpc server in stdlib. Many jsonrpc implementations using external libraries are available, so there is clearly demand, but no standard python library. All of these external implementations seem to require other external libraries for transport, eg. Werkzeug - no way to do this just using stdlib classes. Envisaged Features Identical to existing xmlrpc, just using json instead of xml encoding: --> https://docs.python.org/3/library/xmlrpc.server.html#simplexmlrpcserver-obje... Effort I am too new to python-dev so others should estimate this, but it seems to me that all the hard work has already been done with xmlrpc - only the encoding would have to be adapted to encode/decode json instead of xml, which seems trivial, given that a json module already exists in stdlib. I appreciate your feedback. Kind regards, Achim Andreas von Roznowski
On Mon, 25 Jul 2016 at 01:05 Achim Andreas von Roznowski <dev@roznowski.net> wrote:
Hi
I am new to this mailing list, hopefully this idea hasn't been raised already - I searched the PEPs and python-ideas and couldn't find anything similar, so decided to post this idea. Please forgive me if it is a duplicate.
Idea: add jsonprc server and client to stdlib "Internet Protocols and Support"
Details I would like to suggest adding a jsonrpc server and client to the stdlib "Internet Protocols and Support" with identical functionality to the existing xmlrpc.server and client but using json instead of xml, including a subclass SimpleJSONRPCServer just like SimpleXMLRPCServer based on socketserver.TCPServer.
Rationale JSON is a very common data encoding format, widely established and very close to python's dictionaries, yet there exists today no jsonrpc server in stdlib. Many jsonrpc implementations using external libraries are available, so there is clearly demand, but no standard python library. All of these external implementations seem to require other external libraries for transport, eg. Werkzeug - no way to do this just using stdlib classes.
Envisaged Features Identical to existing xmlrpc, just using json instead of xml encoding: -->
https://docs.python.org/3/library/xmlrpc.server.html#simplexmlrpcserver-obje...
Effort I am too new to python-dev so others should estimate this, but it seems to me that all the hard work has already been done with xmlrpc - only the encoding would have to be adapted to encode/decode json instead of xml, which seems trivial, given that a json module already exists in stdlib.
I appreciate your feedback.
Thanks for the idea, Achim, but I don't think a JSON-RPC library should be in the stdlib. Honestly, if someone was proposing an XML-RPC library to go into the stdlib today I would argue for it not to be included. I don't think JSON-RPC is used by the vast majority of Python users nor difficult enough to implement correctly to warrant being in the stdlib. And even if we thought a JSON-RPC library should be included, I would argue it should be asynchronous, meaning that the xmlrpc library couldn't be reused in any way for the implementation.
participants (2)
-
Achim Andreas von Roznowski
-
Brett Cannon