Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Luke-Jr on April 09, 2011, 02:14:26 PM



Title: [Wiki] Python JSON-RPC example
Post by: Luke-Jr on April 09, 2011, 02:14:26 PM
Does this wording satisfy everyone?

Quote
For Python, python-jsonrpc is the official JSON-RPC implementation. It automatically generates Python methods for RPC calls. However, due to its design for supporting old versions of Python, it is also rather inefficient. jgarzik has forked it as Python-BitcoinRPC and optimized it for current versions (at least Python 2.6+, though not 3.x). Generally, this version is recommended.

While BitcoinRPC lacks a few obscure features from jsonrpc, software using only the ServiceProxy class can be written the same to work with either version the user might choose to install:


Title: Re: [Wiki] Python JSON-RPC example
Post by: Gavin Andresen on April 09, 2011, 03:53:28 PM
What is meant by "rather inefficient"?  Speed of serializing/deserializing?

I can't imagine that is a significant factor for communicating with bitcoin; if you're running into JSON-RPC bottlenecks (is anybody running into performance bottlenecks due to JSON-RPC yet?  If you are, what are you doing?) then the lack of persistent connections, lack of JSON-RPC-2.0-multicall support, or bitcoin single-threaded RPC are likely much, much bigger issues.



Title: Re: [Wiki] Python JSON-RPC example
Post by: genjix on April 09, 2011, 05:00:18 PM
Why do we even recommend JSON-RPC at all?

It's not even an official library for Python and it isn't very good (uses floats and has no persistent connections). We should only be recommending jgarzik's version.


Title: Re: [Wiki] Python JSON-RPC example
Post by: jgarzik on April 09, 2011, 05:10:25 PM
For the record, after my wiki edits were reverted, I wash my hands of the matter.  I do not participate in edit wars.


Title: Re: [Wiki] Python JSON-RPC example
Post by: Luke-Jr on April 09, 2011, 05:33:49 PM
What is meant by "rather inefficient"?  Speed of serializing/deserializing?
That also, but my understanding is that python-jsonrpc only supports single-request-per-connection HTTP/1.0, whereas jgarzik's bitcoinrpc supports HTTP/1.1 persistent connections.
Why do we even recommend JSON-RPC at all?

It's not even an official library for Python and it isn't very good (uses floats and has no persistent connections). We should only be recommending jgarzik's version.
Who recommends it? The proposed summary clearly recommend jgarzik's fork. It is an official library for JSON-RPC.


Title: Re: [Wiki] Python JSON-RPC example
Post by: genjix on April 09, 2011, 05:49:03 PM
I modified JSON-RPC -> jgarzik incorporated code from that -> you've added backwards compatibility.

Stop recommending Dinosaurs when we're at Mammals. It's evolution.

It's even backwards compatible with JSON-RPC if you're a strange person.