@@ -56,6 +56,9 @@ def __init__(self, rpc_error):
5656
5757
5858class BaseProxy (object ):
59+ """Base JSON-RPC proxy class. Contains only private methods; do not use
60+ directly."""
61+
5962 def __init__ (self , service_url = None ,
6063 service_port = None ,
6164 btc_conf_file = None ,
@@ -195,16 +198,17 @@ def __del__(self):
195198
196199
197200class RawProxy (BaseProxy ):
201+ """Low-level proxy to a bitcoin JSON-RPC service
198202
203+ Unlike ``Proxy``, no conversion is done besides parsing JSON. As far as
204+ Python is concerned, you can call any method; ``JSONRPCException`` will be
205+ raised if the server does not recognize it.
206+ """
199207 def __init__ (self , service_url = None ,
200208 service_port = None ,
201209 btc_conf_file = None ,
202210 timeout = DEFAULT_HTTP_TIMEOUT ,
203211 ** kwargs ):
204- """Low-level JSON-RPC proxy
205-
206- Unlike Proxy no conversion is done from the raw JSON objects.
207- """
208212 super (RawProxy , self ).__init__ (service_url = service_url ,
209213 service_port = service_port ,
210214 btc_conf_file = btc_conf_file ,
@@ -226,28 +230,34 @@ def __getattr__(self, name):
226230
227231
228232class Proxy (BaseProxy ):
233+ """Proxy to a bitcoin RPC service
234+
235+ Unlike ``RawProxy``, data is passed as ``bitcoin.core`` objects or packed
236+ bytes, rather than JSON or hex strings. Not all methods are implemented
237+ yet; you can use ``call`` to access missing ones in a forward-compatible
238+ way. Assumes Bitcoin Core version >= 0.9; older versions mostly work, but
239+ there are a few incompatibilities.
240+ """
241+
229242 def __init__ (self , service_url = None ,
230243 service_port = None ,
231244 btc_conf_file = None ,
232245 timeout = DEFAULT_HTTP_TIMEOUT ,
233246 ** kwargs ):
234- """Create a proxy to a bitcoin RPC service
235-
236- Unlike RawProxy data is passed as objects, rather than JSON. (not yet
237- fully implemented) Assumes Bitcoin Core version >= 0.9; older versions
238- mostly work, but there are a few incompatibilities.
247+ """Create a proxy object
239248
240- If service_url is not specified the username and password are read out
241- of the file btc_conf_file. If btc_conf_file is not specified
242- ~/.bitcoin/bitcoin.conf or equivalent is used by default. The default
243- port is set according to the chain parameters in use: mainnet, testnet,
244- or regtest.
249+ If `` service_url`` is not specified, the username and password are read
250+ out of the file `` btc_conf_file`` . If `` btc_conf_file`` is not
251+ specified, `` ~/.bitcoin/bitcoin.conf`` or equivalent is used by
252+ default. The default port is set according to the chain parameters in
253+ use: mainnet, testnet, or regtest.
245254
246- Usually no arguments to Proxy() are needed; the local bitcoind will be
247- used.
255+ Usually no arguments to `` Proxy()`` are needed; the local bitcoind will
256+ be used.
248257
249- timeout - timeout in seconds before the HTTP interface times out
258+ `` timeout`` - timeout in seconds before the HTTP interface times out
250259 """
260+
251261 super (Proxy , self ).__init__ (service_url = service_url , service_port = service_port , btc_conf_file = btc_conf_file ,
252262 timeout = timeout ,
253263 ** kwargs )
0 commit comments