{ "info": { "author": "Christian Decker", "author_email": "decker.christian@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# pylightning: A python client library for lightningd\n\nThis package implements the Unix socket based JSON-RPC protocol that\n`lightningd` exposes to the rest of the world. It can be used to call\narbitrary functions on the RPC interface, and serves as a basis for plugins\nwritten in python.\n\n\n## Installation\n\npylightning is available on `pip`:\n\n```\npip install pylightning\n```\n\nAlternatively you can also install the development version to get access to\ncurrently unreleased features by checking out the c-lightning source code and\ninstalling into your python3 environment:\n\n```bash\ngit clone https://github.com/ElementsProject/lightning.git\ncd lightning/contrib/pylightning\npython3 setup.py develop\n```\n\nThis will add links to the library into your environment so changing the\nchecked out source code will also result in the environment picking up these\nchanges. Notice however that unreleased versions may change API without\nwarning, so test thoroughly with the released version.\n\n## Examples\n\n\n### Using the JSON-RPC client\n```py\n\"\"\"\nGenerate invoice on one daemon and pay it on the other\n\"\"\"\nfrom lightning import LightningRpc\nimport random\n\n# Create two instances of the LightningRpc object using two different c-lightning daemons on your computer\nl1 = LightningRpc(\"/tmp/lightning1/lightning-rpc\")\nl5 = LightningRpc(\"/tmp/lightning5/lightning-rpc\")\n\ninfo5 = l5.getinfo()\nprint(info5)\n\n# Create invoice for test payment\ninvoice = l5.invoice(100, \"lbl{}\".format(random.random()), \"testpayment\")\nprint(invoice)\n\n# Get route to l1\nroute = l1.getroute(info5['id'], 100, 1)\nprint(route)\n\n# Pay invoice\nprint(l1.sendpay(route['route'], invoice['payment_hash']))\n```\n\n### Writing a plugin\n\nPlugins are programs that `lightningd` can be configured to execute alongside\nthe main daemon. They allow advanced interactions with and customizations to\nthe daemon.\n\n```python\n#!/usr/bin/env python3\nfrom lightning import Plugin\n\nplugin = Plugin()\n\n@plugin.method(\"hello\")\ndef hello(plugin, name=\"world\"):\n \"\"\"This is the documentation string for the hello-function.\n\n It gets reported as the description when registering the function\n as a method with `lightningd`.\n\n \"\"\"\n greeting = plugin.get_option('greeting')\n s = '{} {}'.format(greeting, name)\n plugin.log(s)\n return s\n\n\n@plugin.init()\ndef init(options, configuration, plugin):\n plugin.log(\"Plugin helloworld.py initialized\")\n\n\n@plugin.subscribe(\"connect\")\ndef on_connect(plugin, id, address):\n plugin.log(\"Received connect event for peer {}\".format(id))\n\n\nplugin.add_option('greeting', 'Hello', 'The greeting I should use.')\nplugin.run()\n\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ElementsProject/lightning", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pyln-client", "package_url": "https://pypi.org/project/pyln-client/", "platform": "", "project_url": "https://pypi.org/project/pyln-client/", "project_urls": { "Homepage": "http://github.com/ElementsProject/lightning" }, "release_url": "https://pypi.org/project/pyln-client/0.0.7.3/", "requires_dist": [ "pylightning (==0.0.7.3)" ], "requires_python": "", "summary": "Client library for lightningd", "version": "0.0.7.3" }, "last_serial": 5778069, "releases": { "0.0.7.3": [ { "comment_text": "", "digests": { "md5": "4b96e1b8f5a86e3e03088fcb778ef638", "sha256": "7ba09b634b8594bdae76b54621da0858ae9d454a46a5ee7c10ad95043f6037a6" }, "downloads": -1, "filename": "pyln_client-0.0.7.3-py3-none-any.whl", "has_sig": false, "md5_digest": "4b96e1b8f5a86e3e03088fcb778ef638", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2817, "upload_time": "2019-09-03T21:40:11", "url": "https://files.pythonhosted.org/packages/aa/99/c443ddd0e94b4e0daaea8aeb5a53ef9f5133190e1292bf713a39deaa4b05/pyln_client-0.0.7.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fab95d2afb6118abf50721dad214ab87", "sha256": "b5a2122a98457cff42620b2292fc1c1fb7adc91b0c28116a522a580bbb76abd8" }, "downloads": -1, "filename": "pyln-client-0.0.7.3.tar.gz", "has_sig": false, "md5_digest": "fab95d2afb6118abf50721dad214ab87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2692, "upload_time": "2019-09-03T21:40:14", "url": "https://files.pythonhosted.org/packages/78/fe/814c469492a8c06dd001e4e1c770ce4b43141e01d8f2d590d4d69e23dc31/pyln-client-0.0.7.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4b96e1b8f5a86e3e03088fcb778ef638", "sha256": "7ba09b634b8594bdae76b54621da0858ae9d454a46a5ee7c10ad95043f6037a6" }, "downloads": -1, "filename": "pyln_client-0.0.7.3-py3-none-any.whl", "has_sig": false, "md5_digest": "4b96e1b8f5a86e3e03088fcb778ef638", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2817, "upload_time": "2019-09-03T21:40:11", "url": "https://files.pythonhosted.org/packages/aa/99/c443ddd0e94b4e0daaea8aeb5a53ef9f5133190e1292bf713a39deaa4b05/pyln_client-0.0.7.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fab95d2afb6118abf50721dad214ab87", "sha256": "b5a2122a98457cff42620b2292fc1c1fb7adc91b0c28116a522a580bbb76abd8" }, "downloads": -1, "filename": "pyln-client-0.0.7.3.tar.gz", "has_sig": false, "md5_digest": "fab95d2afb6118abf50721dad214ab87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2692, "upload_time": "2019-09-03T21:40:14", "url": "https://files.pythonhosted.org/packages/78/fe/814c469492a8c06dd001e4e1c770ce4b43141e01d8f2d590d4d69e23dc31/pyln-client-0.0.7.3.tar.gz" } ] }