{ "info": { "author": "tryexceptpass", "author_email": "cmedina@tryexceptpass.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: AsyncIO", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Communications", "Topic :: Internet" ], "description": "Korv is an API framework that uses TCP sockets over SSH to exchange JSON data with a REST-like protocol. It's built on top of the `asyncssh` module, so it uses `asyncio` to manage the sockets and its callbacks. This allows you to build rich APIs with the session security of SSH and without the TCP overhead of HTTP.\n\nCommunications over this framework requires SSH keys like logging into a normal SSH server:\n* The server itself has a private key and a set of public keys for the authorized clients.\n* The client has a private key and a set of public keys for the servers it can connect to.\n\n\n## Verbs\nThere are 4 main verbs that indicate the intent of your request:\n* `GET` for retrieving information.\n* `STORE` for creating new objects.\n* `UPDATE` for changing existing objects.\n* `DELETE` for removing objects.\n\n\n## Keys\nAs discussed previously, you establish an SSH session with the server, so it's possible to reuse existing keys or generate them through any standard mechanism like the one below:\n\n```bash\nssh-keygen -t rsa -b 4096 -C \"your_email@example.com\"\n```\n\n## Server\nGetting a server up and running is very simple:\n\n```python\nfrom korv import KorvServer\n\n\ndef hello(request):\n \"\"\"Callback for the /hello endpoint\"\"\"\n\n return 200, {'msg': 'Hello World!'}\n\ndef echo(request):\n \"\"\"Callback for the /echo endpoint\"\"\"\n\n return 200, {'msg': f'{request}'}\n\n\n# Create a server\nk = KorvServer(host_keys=['PATH_TO_YOUR_SERVER_PRIVATE_KEY'], authorized_client_keys='PATH_TO_YOUR_AUTHORIZED_PUBLIC_KEYS')\n\n# Register the callbacks\nk.add_callback('GET', '/hello', hello)\nk.add_callback('GET', '/echo', echo)\n\n# Start listening for requests\nk.start()\n```\n\nThis will start a new SSH server with the specified private key that listens on port `8022` by default and will accept the clients listed in the authorized keys.\n\n## Client\nFollowing is an example on how to communicate with this server.\n\n```python\n>>> from korv import KorvClient\n>>>\n>>> # Create the client\n>>> k = KorvClient(client_keys=['PATH_TO_YOUR_CLIENTS_PRIVATE_KEY'])\n>>>\n>>> # Issue a GET request and print the output\n>>> k.get('/hello', callback=lambda response: print(response['body']))\n>>> {'msg': 'Hello World!'}\n```\n\n## Return Codes\nWe're using standard HTTP response codes:\n* `200` = Success.\n* `400` = Malformed request or missing parameters.\n* `404` = NotFound\n* `500` = Internal error.\n\nServer exceptions map to a `500` return code ans will include a traceback in the response.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tryexceptpass/korv", "keywords": "ssh api framework", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "korv", "package_url": "https://pypi.org/project/korv/", "platform": "", "project_url": "https://pypi.org/project/korv/", "project_urls": { "Gitter Chat": "https://gitter.im/try-except-pass/korv", "Homepage": "https://github.com/tryexceptpass/korv", "Say Thanks!": "https://saythanks.io/to/tryexceptpass", "Source": "https://github.com/tryexceptpass/korv" }, "release_url": "https://pypi.org/project/korv/0.2.1/", "requires_dist": null, "requires_python": ">=3.6", "summary": "SSH API Framework", "version": "0.2.1" }, "last_serial": 4706415, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "18e812f2ff2b162abd476917d4743abb", "sha256": "aadad2a8e09db1b41904bdb831c1898322fe9d39e6cda192aff73fbb52087925" }, "downloads": -1, "filename": "korv-0.1.0.tar.gz", "has_sig": false, "md5_digest": "18e812f2ff2b162abd476917d4743abb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3683, "upload_time": "2018-04-30T22:11:48", "url": "https://files.pythonhosted.org/packages/66/ed/1fc96314a3fed6c9490ff11c3befc72a28fa74479e3120591d7b34932eea/korv-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "58aa62c60307ec04c946a93028481e97", "sha256": "a8ba835b924147c4ed180d89bc960b058cab19d5ceafe8c927cafae9e8ae909c" }, "downloads": -1, "filename": "korv-0.1.1.tar.gz", "has_sig": false, "md5_digest": "58aa62c60307ec04c946a93028481e97", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4982, "upload_time": "2018-04-30T22:44:44", "url": "https://files.pythonhosted.org/packages/3c/e9/ba3e5a473fd0c06db955397ad961d28339bd1e39b9e6a00b443473d7cc0b/korv-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "a8921595f66aa15672f4dea84c9697ed", "sha256": "b00b09c5ce0e4f1766f217add99bdf1ab4c7dddbad123dadb8c7297db20ba2c9" }, "downloads": -1, "filename": "korv-0.1.2.tar.gz", "has_sig": false, "md5_digest": "a8921595f66aa15672f4dea84c9697ed", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 5084, "upload_time": "2018-06-13T00:47:01", "url": "https://files.pythonhosted.org/packages/1a/5e/5e104655343261812e8e1c390c2fc1cdfd1c7b53775e38fc23f61cef24f6/korv-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "36055c1a0d0d4c69f988119f55e5d8c1", "sha256": "fcc469ef65582f913ebfc81b63b69c021f1ee882b2170e75cf293cdd86ae65df" }, "downloads": -1, "filename": "korv-0.1.3.tar.gz", "has_sig": false, "md5_digest": "36055c1a0d0d4c69f988119f55e5d8c1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 5169, "upload_time": "2019-01-08T03:54:08", "url": "https://files.pythonhosted.org/packages/01/eb/99cdb4ad49270e33a76468cd1105ab3cdfbaf50bc791ea4908033bf3ce77/korv-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "d758f6918d9774185c210b1314ddd6e9", "sha256": "454b6b29f3a8284c35376c47872f5f2ee39b2f6453ca38dbe63953ed067cdac8" }, "downloads": -1, "filename": "korv-0.2.0.tar.gz", "has_sig": false, "md5_digest": "d758f6918d9774185c210b1314ddd6e9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 5207, "upload_time": "2019-01-17T05:20:38", "url": "https://files.pythonhosted.org/packages/52/b6/08c53c3b5eff68c6562d04312f6039b0d235dd5692a2c883d111be5da811/korv-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "4cc83656ced6ac35ce5d6206977f628e", "sha256": "9f174e27a0eb032d661aea86f76ff1a49434e57969cc3eb9a0fad5c88cf52ae7" }, "downloads": -1, "filename": "korv-0.2.1.tar.gz", "has_sig": false, "md5_digest": "4cc83656ced6ac35ce5d6206977f628e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 5200, "upload_time": "2019-01-17T05:32:22", "url": "https://files.pythonhosted.org/packages/35/cc/329346d1c336696d5e8d8195b01d2cb9d785106ebda5b2d9283c762be9d6/korv-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4cc83656ced6ac35ce5d6206977f628e", "sha256": "9f174e27a0eb032d661aea86f76ff1a49434e57969cc3eb9a0fad5c88cf52ae7" }, "downloads": -1, "filename": "korv-0.2.1.tar.gz", "has_sig": false, "md5_digest": "4cc83656ced6ac35ce5d6206977f628e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 5200, "upload_time": "2019-01-17T05:32:22", "url": "https://files.pythonhosted.org/packages/35/cc/329346d1c336696d5e8d8195b01d2cb9d785106ebda5b2d9283c762be9d6/korv-0.2.1.tar.gz" } ] }