{ "info": { "author": "Norman Moeschter-Schenck", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "# python-monerorpc\n\n**python-monerorpc** is an improved version of python-jsonrpc for Monero (`monerod rpc`, `monero-wallet-rpc`).\n\n**python-monerorpc** was originally forked from [**python-bitcoinrpc**](https://github.com/jgarzik/python-bitcoinrpc).\n\nIt includes the following generic improvements:\n\n- HTTP connections persist for the life of the `AuthServiceProxy` object using `requests.Session`\n- sends protocol 'jsonrpc', per JSON-RPC 2.0\n- sends proper, incrementing 'id'\n- uses standard Python json lib\n- can optionally log all RPC calls and results\n- JSON-2.0 batch support (mimicking batch)\n - JSON-2.0 batch doesn't seem to work with monero.\n - The batch functionality is mimicked and just requests the given methods one after another.\n - The result is a list of dictionaries.\n\nIt also includes some more specific details:\n\n- sends Digest HTTP authentication headers\n- parses all JSON numbers that look like floats as Decimal,\n and serializes Decimal values to JSON-RPC connections.\n\n## What does it do?\n\n**python-monerorpc** communicates with monero over RPC.\n\nThat includes:\n\n- `monerod rpc` as well as\n- `monero-wallet-rpc`.\n\n**python-monerorpc** takes over the actual HTTP request containing all the necessary headers.\n\n## Compared to similar projects:\n\n- [**monero-python**](https://github.com/emesik/monero-python)\n - **monero-python**\n - The module implements a json RPC backend (`monerod rpc`, `monero-wallet-rpc`).\n - It implements implementations around this backend (accounts, wallets, transactions, etc. )\n - It offers helpful utilities like a monero wallet address validator.\n- A practical difference:\n\n - Should a RPC method change or a new one should be added, **monero-python** would have to adapt its backend and the implementations around it, while with **python-monerorpc** you just have to modify the property or use a new method like:\n\n ```python\n rpc_connection.getbalance() # -> rpc_connection.get_balance()\n rpc_connection.new_method()\n ```\n\n## Installation:\n\n### From PyPI\n\nTo install `python-monerorpc` from PyPI using `pip` you just need to:\n\n> \\$ pip install python-monerorpc\n\n### From Source\n\n> \\$ python setup.py install --user\n\n**Note**: This will only install `monerorpc`. If you also want to install `jsonrpc` to preserve\nbackwards compatibility, you have to replace `monerorpc` with `jsonrpc` in `setup.py` and run it again.\n\n## Examples:\n\nExample usage `monerod` (get info):\n\n```python\n from monerorpc.authproxy import AuthServiceProxy, JSONRPCException\n\n # initialisation, rpc_user and rpc_password are set as flags in the cli command\n rpc_connection = AuthServiceProxy('http://{0}:{1}@127.0.0.1:18081/json_rpc'.format(rpc_user, rpc_password))\n\n info = rpc_connection.get_info()\n print(info)\n\n # rpc_user and rpc_password can also be left out (testing, develop, not recommended)\n rpc_connection = AuthServiceProxy('http://127.0.0.1:18081/json_rpc')\n```\n\nExample usage `monerod` (get network type):\n\n```python\n from monerorpc.authproxy import AuthServiceProxy, JSONRPCException\n rpc_connection = AuthServiceProxy('http://{0}:{1}@127.0.0.1:18081/json_rpc'.format(rpc_user, rpc_password))\n\n result = None\n network_type = None\n try:\n result = rpc_connection.get_info()\n except (requests.HTTPError,\n requests.ConnectionError,\n JSONRPCException) as e:\n logger.error('RPC Error on getting address' + str(e))\n logger.exception(e)\n # Check network type\n network_type = result.get('nettype')\n if not network_type:\n raise ValueError('Error with: {0}'.format(result))\n print(network_type)\n```\n\nExample usage `monerod` (on get block hash):\n\n```python\n from monerorpc.authproxy import AuthServiceProxy, JSONRPCException\n rpc_connection = AuthServiceProxy('http://{0}:{1}@127.0.0.1:18081/json_rpc'.format(rpc_user, rpc_password))\n\n params = [2]\n hash = rpc.on_get_block_hash(params)\n print(hash)\n```\n\nExample usage `monero-wallet-rpc` (get balance):\n\n```python\n from monerorpc.authproxy import AuthServiceProxy, JSONRPCException\n\n # initialisation, rpc_user and rpc_password are set as flags in the cli command\n rpc_connection = AuthServiceProxy('http://{0}:{1}@127.0.0.1:18083/json_rpc'.format(rpc_user, rpc_password))\n\n balance = rpc_connection.get_balance()\n print(balance)\n```\n\nExample usage `monero-wallet-rpc` (make transfer):\n\n```python\n from monerorpc.authproxy import AuthServiceProxy, JSONRPCException\n\n # initialisation, rpc_user and rpc_password are set as flags in the cli command\n rpc_connection = AuthServiceProxy('http://{0}:{1}@127.0.0.1:18083/json_rpc'.format(rpc_user, rpc_password))\n\n destinations = {\"destinations\": [{\"address\": \"some_address\", \"amount\": 1}], \"mixin\": 10}\n result = rpc_connection.transfer(destinations)\n print(result)\n```\n\nExample usage `monero-wallet-rpc` (batch):\n\n```python\n from monerorpc.authproxy import AuthServiceProxy, JSONRPCException\n import pprint\n\n # initialisation, rpc_user and rpc_password are set as flags in the cli command\n rpc_connection = AuthServiceProxy('http://{0}:{1}@127.0.0.1:18083/json_rpc'.format(rpc_user, rpc_password))\n\n # some example batch\n params={\"account_index\":0,\"address_indices\":[0,1]}\n result = rpc.batch_([ [\"get_balance\"], [\"get_balance\", params] ])\n pprint.pprint(result)\n\n # make transfer and get balance in a batch\n destinations = {\"destinations\": [{\"address\": \"some_address\", \"amount\": 1}], \"mixin\": 10}\n result = rpc.batch_([ [\"transfer\", destinations], [\"get_balance\"] ])\n pprint.pprint(result)\n```\n\n## Logging:\n\nLogging all RPC calls to stderr:\n\n```python\n from monerorpc.authproxy import AuthServiceProxy, JSONRPCException\n import logging\n\n logging.basicConfig()\n logging.getLogger(\"MoneroRPC\").setLevel(logging.DEBUG)\n\n rpc_connection = AuthServiceProxy('http://{0}:{1}@127.0.0.1:18081/json_rpc'.format(rpc_user, rpc_password))\n\n print(rpc_connection.get_info())\n```\n\nProduces output on stderr like:\n\n```bash\n DEBUG:MoneroRPC:-1-> get_info []\n DEBUG:MoneroRPC:<-1- {u'result': {u'incoming_connections_count': 0, ...etc }\n```\n\n## Errors:\n\nPossible errors and error codes:\n\n* `no code`\n - Returns the `error` contained in the RPC response.\n* `-341`\n - `could not establish a connection, original error: {}`\n - including the original exception message\n* `-342`\n - `missing HTTP response from server`\n* `-343`\n - `missing JSON-RPC result`\n* `-344`\n - `received HTTP status code {}`\n - including HTTP status code other than `200`\n\n## Testing:\n\nInstall the test requirements:\n```bash\n virtualenv -q venv\n . venv/bin/activate\n pip install -r requirements.txt\n```\n\nRun unit tests using `pytest`:\n```bash\n # virtualenv activated (see above)\n pytest tests.py\n```\n\n## Authors\n\n* **Norman Moeschter-Schenck** - *Initial work* - [normoes](https://github.com/normoes)\n\nSee also the list of [contributors](contributors.md) who participated in this project.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/monero-ecosystem/python-monerorpc/archive/0.5.5.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.github.com/monero-ecosystem/python-monerorpc", "keywords": "", "license": "", "maintainer": "Norman Moeschter-Schenck", "maintainer_email": "", "name": "python-monerorpc", "package_url": "https://pypi.org/project/python-monerorpc/", "platform": "", "project_url": "https://pypi.org/project/python-monerorpc/", "project_urls": { "Download": "https://github.com/monero-ecosystem/python-monerorpc/archive/0.5.5.tar.gz", "Homepage": "https://www.github.com/monero-ecosystem/python-monerorpc" }, "release_url": "https://pypi.org/project/python-monerorpc/0.5.5/", "requires_dist": null, "requires_python": "", "summary": "Enhanced version of python-jsonrpc for Monero (monerod, monero-wallet-rpc).", "version": "0.5.5" }, "last_serial": 4693019, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "2edfd8a0ba52c707c466381b232e4b10", "sha256": "065a84499c826050f7da1d59ee11489f23edd7bfe9a6b0e96b9ee1c978476bf0" }, "downloads": -1, "filename": "python_monerorpc-0.3-py2.7.egg", "has_sig": false, "md5_digest": "2edfd8a0ba52c707c466381b232e4b10", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 9371, "upload_time": "2018-10-06T19:03:49", "url": "https://files.pythonhosted.org/packages/41/79/7be44a63da0cbaee683f758e23572940c34487969200bfd46a02ee9acb87/python_monerorpc-0.3-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "04cfb54fbf2f9cee8014372c5b99c830", "sha256": "a223e7ca5a4bfbcd765c385d37284424c8cb25d36423442e2fa42d2d84a1d78f" }, "downloads": -1, "filename": "python_monerorpc-0.3-py3.6.egg", "has_sig": false, "md5_digest": "04cfb54fbf2f9cee8014372c5b99c830", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 9341, "upload_time": "2018-10-06T19:03:51", "url": "https://files.pythonhosted.org/packages/fd/2f/73a0f7fccb459a34e39b29040e567bcf198131246b2b164bc59a4fd20287/python_monerorpc-0.3-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "48d39ccbb11e14051c22f6a3c060f8ae", "sha256": "33cbc3d981ea7aecef758e131b4c3157e098a7ebe6f119a690049c590008d513" }, "downloads": -1, "filename": "python-monerorpc-0.3.tar.gz", "has_sig": false, "md5_digest": "48d39ccbb11e14051c22f6a3c060f8ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5192, "upload_time": "2018-10-06T19:03:52", "url": "https://files.pythonhosted.org/packages/ee/8c/6b2e67bea51202893ec68aa38110255abfef891b44fc986f91e1ef6ad062/python-monerorpc-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "efebd4aebb4eb15a9a44b810ad25851f", "sha256": "182b736bf39147c0ed36ee46da2f96d4a46ab61012824b36894e4bb358b441b3" }, "downloads": -1, "filename": "python-monerorpc-0.3.1.tar.gz", "has_sig": false, "md5_digest": "efebd4aebb4eb15a9a44b810ad25851f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5257, "upload_time": "2018-10-07T10:35:48", "url": "https://files.pythonhosted.org/packages/e2/ba/0f1fbacae6ec3d7e39a85637e0e582f482a039598dd2decd39f289789fa2/python-monerorpc-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "cbdfa816d8b1bf18513caaf258eeb2c6", "sha256": "bd93307f98fa00e26740976013fc4554b39f0012656fd64c250ea6359efa0fe6" }, "downloads": -1, "filename": "python_monerorpc-0.3.2-py2.7.egg", "has_sig": false, "md5_digest": "cbdfa816d8b1bf18513caaf258eeb2c6", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 9416, "upload_time": "2018-10-08T08:43:01", "url": "https://files.pythonhosted.org/packages/48/7c/9d9690757ca61677239ed697201d36666fc1b937d24f1369a2776fed026b/python_monerorpc-0.3.2-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "a537309875d38c34380028859ea85f0e", "sha256": "b18ac706c386d806c0dcbc5b6a9506cb5969692ad62d9d7403a115a7f22ab673" }, "downloads": -1, "filename": "python-monerorpc-0.3.2.tar.gz", "has_sig": false, "md5_digest": "a537309875d38c34380028859ea85f0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5230, "upload_time": "2018-10-07T15:44:14", "url": "https://files.pythonhosted.org/packages/aa/11/1739b4dbf427e5a631d1ab95e2a5d2d0c88ae6fdca27bea362d8dd332f1b/python-monerorpc-0.3.2.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "a5c41e323778a72b250c7e42730b5faa", "sha256": "f1b9246d39ea26a29b950360d9f13d4bd6cf74fa1cbde9fdf48c97d8ea9cbf42" }, "downloads": -1, "filename": "python-monerorpc-0.4.tar.gz", "has_sig": false, "md5_digest": "a5c41e323778a72b250c7e42730b5faa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5564, "upload_time": "2018-10-08T08:45:50", "url": "https://files.pythonhosted.org/packages/66/85/47fd29b9cb2bc1bc7de0a6ff23b3baf48f7ee8cb1087369ea3ae60b26160/python-monerorpc-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "db1c23309471f4cd52cf175744dede2c", "sha256": "bda46bd9fbbee58a46d22692edb5e334a8fa70f7b8350a2de9f2bc54230415d8" }, "downloads": -1, "filename": "python-monerorpc-0.5.tar.gz", "has_sig": false, "md5_digest": "db1c23309471f4cd52cf175744dede2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5562, "upload_time": "2018-10-10T07:15:11", "url": "https://files.pythonhosted.org/packages/30/97/3d903ff4cbdb914bd2b7d21f340b63efc524733af2fcc09b302517d2bd17/python-monerorpc-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "09ae131550fecf09b4cc0f2089a5228f", "sha256": "a0cdc81820bb45e539931846ef35aa4e50f1170562465a0500d2db208f84e0c1" }, "downloads": -1, "filename": "python-monerorpc-0.5.1.tar.gz", "has_sig": false, "md5_digest": "09ae131550fecf09b4cc0f2089a5228f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5847, "upload_time": "2018-10-15T08:59:29", "url": "https://files.pythonhosted.org/packages/7e/e0/34dbb1d19d2d6b45100949c39adf4cc142afbf9b0cd25a6462b12dc0ece2/python-monerorpc-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "2d5861005b8ae6b996cd3a508497c2b7", "sha256": "070ede6920b66d07a2d1b430c516e9f7addf35ab9427871f5d384d2e7035f773" }, "downloads": -1, "filename": "python-monerorpc-0.5.2.tar.gz", "has_sig": false, "md5_digest": "2d5861005b8ae6b996cd3a508497c2b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5916, "upload_time": "2018-10-25T09:05:32", "url": "https://files.pythonhosted.org/packages/23/80/7709d4beb291a2ce2e21490dd849398711fe7003c5b096592bf0b0e68ac2/python-monerorpc-0.5.2.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "cbc98cdf6de8df03187f1fcfd8b34085", "sha256": "ee734607d226fe8afd9c1595b99406f55237825ada903af7d800eed1e5058407" }, "downloads": -1, "filename": "python-monerorpc-0.5.3.tar.gz", "has_sig": false, "md5_digest": "cbc98cdf6de8df03187f1fcfd8b34085", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5909, "upload_time": "2018-11-06T05:19:41", "url": "https://files.pythonhosted.org/packages/05/72/455c23e25ba00a5518bae1cda2bdade0437b1865e31e4009e4fb805d7670/python-monerorpc-0.5.3.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "f27300fce223386df6e278a1b32a1664", "sha256": "232c1faf8811be9536448a901e9b435422bc5570051d0f985206456cf36c2038" }, "downloads": -1, "filename": "python-monerorpc-0.5.4.tar.gz", "has_sig": false, "md5_digest": "f27300fce223386df6e278a1b32a1664", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6068, "upload_time": "2018-12-07T13:25:32", "url": "https://files.pythonhosted.org/packages/d2/9f/eda40bcb689379dc8972fe952dae896992a3d28433fbf35375afdd970186/python-monerorpc-0.5.4.tar.gz" } ], "0.5.5": [ { "comment_text": "", "digests": { "md5": "cf2104205a18af292e930268c4f5d00f", "sha256": "daed98ff80103d86da45001f9ad81ba2cfcdb6687fde5249f1dfcfd9da0b64b4" }, "downloads": -1, "filename": "python-monerorpc-0.5.5.tar.gz", "has_sig": false, "md5_digest": "cf2104205a18af292e930268c4f5d00f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6479, "upload_time": "2019-01-14T07:09:24", "url": "https://files.pythonhosted.org/packages/5d/c7/eb380e2e3037bb7256086e4d015ea3d66cee98e328f8019b947acd6fd179/python-monerorpc-0.5.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cf2104205a18af292e930268c4f5d00f", "sha256": "daed98ff80103d86da45001f9ad81ba2cfcdb6687fde5249f1dfcfd9da0b64b4" }, "downloads": -1, "filename": "python-monerorpc-0.5.5.tar.gz", "has_sig": false, "md5_digest": "cf2104205a18af292e930268c4f5d00f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6479, "upload_time": "2019-01-14T07:09:24", "url": "https://files.pythonhosted.org/packages/5d/c7/eb380e2e3037bb7256086e4d015ea3d66cee98e328f8019b947acd6fd179/python-monerorpc-0.5.5.tar.gz" } ] }