{ "info": { "author": "daseinpwt", "author_email": "daseinpwt@gmail.com", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Rufmich\nA Python server implementaion of [JSON-RPC 2.0](https://www.jsonrpc.org/specification) over HTTP.\n\n## Introduction\n**rufmich** is an HTTP server for JSON-RPC 2.0. To make the JSON-RPC 2.0 work over HTTP, following specifications are added:\n\n1. The transport protocol is HTTP. The response for an notification is an HTTP response with status code 204 (No Response) and empty content. The HTTP requests must have the header `content-type: application/json`, otherwise there will be an HTTP error 415 (Unsupported Media Type).\n2. A notification request will get an immediate response. Usually the server will start the procedure and return the response immediately (without having to wait for the procedure to finish). And there is no callback for the procedure, which means the client would not be aware of any errors.\n3. Method namespacing is supported (and recommended).\n\n### Notification\nNotification is implemented using threading. A method without `id` will be invoked asynchronously in a new thread and the client will get an HTTP response with status code 204 after the creation of the thread.\n\n### Batch\nIf multiple requests are sent in a batch, they will be processed concurrently by a thread pool. Only results of non-notification requests are returned. In case of that all the requests are notifications, the HTTP response will be of status 204.\n\n## User Guide\n### Installation\n`pip install rufmich`\n\n### Define methods\nCreate a folder with following structure:\n```\n- \n - root\n root.py\n - \n \n - \n \n - \n \n```\n\nAn example is:\n```\n- my_methods\n - root\n root.py\n - registration\n registration.py\n - by_email\n by_email.py\n```\n\n*Note that there MUST BE a directory named root under your workspace folder.*\n\nEach namespace folder MUST HAVE a `.py` file with the same name as the folder. The methods defined in those `.py` files will be indexed according to the folder hierarchy.\n\nExamples:\n1. A method `foobar` defined in `root.py` is indexed to `\"foobar\"` and `\"::foobar\"`\n2. A method `send_code_to_email` defined in `by_email.py` in the above example is indexed to `\"registration::by_email::send_code_to_email\"` (and `\"::registration::by_email::send_code_to_email\"`)\n\n### Application-specific errors\nThe error codes from -32000 to -32099 are reserved for implementation-defined server-errors. The RPC server developer can raise an application-specific error by using `RMError`:\n\n```python\nfrom rufmich.error import RMError\n\ndef division(a, b):\n if b == 0:\n raise RMError(eid=0, message='divided by 0', data=[a, b])\n return a / b\n```\n\nEach application-specific error should have an unique error id `eid` (0 <= eid <= 99). The error is mapped to [-32000, -32099] by the function `f: eid -> -32000-eid`.\n\n### Run\n```python\nfrom rufmich.server import RMServer\n\nserver = RMServer(load_path='/workspace/methods')\nserver.run(endpoint='/jsonrpc', port=8080)\n```\n\n### Client examples\nCheck on [the website of JSON-RPC 2.0 Specification](https://www.jsonrpc.org/specification#examples).\n\n", "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/daseinpwt/rufmich", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "rufmich", "package_url": "https://pypi.org/project/rufmich/", "platform": "", "project_url": "https://pypi.org/project/rufmich/", "project_urls": { "Homepage": "https://github.com/daseinpwt/rufmich" }, "release_url": "https://pypi.org/project/rufmich/1.0.6/", "requires_dist": [ "flask" ], "requires_python": "", "summary": "A Python server implementaion of JSON-RPC 2.0 over HTTP", "version": "1.0.6" }, "last_serial": 5276343, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "7ce845345f7f4dff6bbf9a5f13e3bfde", "sha256": "2a6fb3880b0da791fb20cd5baf7692acd8f600c0dd93c0460035d7149e203c4f" }, "downloads": -1, "filename": "rufmich-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7ce845345f7f4dff6bbf9a5f13e3bfde", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16346, "upload_time": "2019-05-14T14:13:21", "url": "https://files.pythonhosted.org/packages/20/e1/9b55719c514e345413fbc7e4e6078f9db0f2509c5b4d98548cf148b8b966/rufmich-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7e286788a4ae390d53dfd8c10606309e", "sha256": "b8643f79c5af73caccd5d208201106efb7b467bf0d4114153ff9c31725b72730" }, "downloads": -1, "filename": "rufmich-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7e286788a4ae390d53dfd8c10606309e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3140, "upload_time": "2019-05-14T14:13:23", "url": "https://files.pythonhosted.org/packages/62/27/67806f355a6226d41fbf575c8f45919cf338f37c0a6b20e03c7181372a08/rufmich-0.1.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "3e2a2d02acf2dc968cbd548773263aab", "sha256": "a7365215b4bd41d1abff8725552a8c60e72f9daf8d5089cb588af8e5da3cf49a" }, "downloads": -1, "filename": "rufmich-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3e2a2d02acf2dc968cbd548773263aab", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16959, "upload_time": "2019-05-15T19:54:12", "url": "https://files.pythonhosted.org/packages/bd/48/3200f26bf647f495d6522003604665695dcfd5679135fa9e3d4cb8a32177/rufmich-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aa30c554166fafda451f438c3644be04", "sha256": "b9190224d0ba4f072c1e157fb5226b51cfd752b9be181c507c01637fc11b4087" }, "downloads": -1, "filename": "rufmich-1.0.0.tar.gz", "has_sig": false, "md5_digest": "aa30c554166fafda451f438c3644be04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3765, "upload_time": "2019-05-15T19:54:13", "url": "https://files.pythonhosted.org/packages/ca/ab/db16522710f3c98d580a4b1e52cbf767fa3b8f25f49bec2d17ca17ad19c1/rufmich-1.0.0.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "578405241afd708b54a6838659a8b7b3", "sha256": "b49cfaff43b47ba2b7e373fe321ca63945b666fbeac98519e3129dd889b3ed7c" }, "downloads": -1, "filename": "rufmich-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "578405241afd708b54a6838659a8b7b3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17148, "upload_time": "2019-05-15T20:36:23", "url": "https://files.pythonhosted.org/packages/36/68/e7590b3b31117c9454f973e782cf2cbee84d6b0381192c8093a7b5aa7aaf/rufmich-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fc46549699bb70379713ffe9e3985df7", "sha256": "f4996de9274a1e6dcc9a5d7401efb08d5a388d625ce4ab1b3bdfc47422f13736" }, "downloads": -1, "filename": "rufmich-1.0.2.tar.gz", "has_sig": false, "md5_digest": "fc46549699bb70379713ffe9e3985df7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3909, "upload_time": "2019-05-15T20:36:24", "url": "https://files.pythonhosted.org/packages/c3/9e/b71e77123299ee606aeebe97a0f7fa40bfc113d4945993173a0042c0dd34/rufmich-1.0.2.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "c700ddd0b0168389d85966f7fba505bd", "sha256": "7e5a2c6153996b395d64c03f6002894f185d97ee1163812567e363029e560893" }, "downloads": -1, "filename": "rufmich-1.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "c700ddd0b0168389d85966f7fba505bd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17514, "upload_time": "2019-05-16T08:46:54", "url": "https://files.pythonhosted.org/packages/a5/c1/1521754b512578537531b8fc149b2eb05627a60160c56c7c6887793e0ac4/rufmich-1.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "774e538c20f41513355e4a9064b84556", "sha256": "4e1c5e5230ef39a2dabe3e186114e9b2f59bbd061f60659248e79de6015b03bf" }, "downloads": -1, "filename": "rufmich-1.0.6.tar.gz", "has_sig": false, "md5_digest": "774e538c20f41513355e4a9064b84556", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4334, "upload_time": "2019-05-16T08:46:56", "url": "https://files.pythonhosted.org/packages/20/68/3713c7398b1f599fb967cad4b9269019ebce3078b79d4c4c424f7350d7b4/rufmich-1.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c700ddd0b0168389d85966f7fba505bd", "sha256": "7e5a2c6153996b395d64c03f6002894f185d97ee1163812567e363029e560893" }, "downloads": -1, "filename": "rufmich-1.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "c700ddd0b0168389d85966f7fba505bd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17514, "upload_time": "2019-05-16T08:46:54", "url": "https://files.pythonhosted.org/packages/a5/c1/1521754b512578537531b8fc149b2eb05627a60160c56c7c6887793e0ac4/rufmich-1.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "774e538c20f41513355e4a9064b84556", "sha256": "4e1c5e5230ef39a2dabe3e186114e9b2f59bbd061f60659248e79de6015b03bf" }, "downloads": -1, "filename": "rufmich-1.0.6.tar.gz", "has_sig": false, "md5_digest": "774e538c20f41513355e4a9064b84556", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4334, "upload_time": "2019-05-16T08:46:56", "url": "https://files.pythonhosted.org/packages/20/68/3713c7398b1f599fb967cad4b9269019ebce3078b79d4c4c424f7350d7b4/rufmich-1.0.6.tar.gz" } ] }