{ "info": { "author": "Takashi WATANABE", "author_email": "wtnb75@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Topic :: Communications" ], "description": "# lotrpc: RPC abstraction layer\n\nlotrpc unifies a lot of RPC protocols.\n\nprotocols:\n\n- XML-RPC http://xmlrpc.scripting.com/\n- JSON RPC https://www.jsonrpc.org/specification\n- MessagePack RPC https://msgpack.org/\n- gRPC https://grpc.io/\n- ZeroRPC https://www.zerorpc.io/\n\n> One RPC to rule them all, One RPC to find them, One RPC to bring them all, and in the darkness bind them.\n\n# install\n\n- python -m venv your-dir\n- cd your-dir\n- ./bin/pip install lotrpc\n\n## install head\n\n- python -m venv your-dir\n- cd your-dir\n- ./bin/pip install -r https://github.com/wtnb75/lotrpc/raw/master/requirements.txt\n- ./bin/pip install -e \"git+https://github.com/wtnb75/lotrpc.git#egg=lotrpc\"\n\n# Usage\n\n## client-server example\n\n- xmlrpc\n - ./bin/python -m lotrpc.clsrv server xml\n - ./bin/python -m lotrpc.clsrv client xml\n- json-rpc\n - ./bin/python -m lotrpc.clsrv server json\n - ./bin/python -m lotrpc.clsrv client json\n - curl -X POST -d '{\"method\":\"hello\", \"jsonrpc\":\"2.0\", \"params\":[\"a\",\"b\",\"c\"]}' http://localhost:9999/\n- msgpack-rpc\n - ./bin/python -m lotrpc.clsrv server msgpack\n - ./bin/python -m lotrpc.clsrv client msgpack\n- msgpack-rpc with mprpc\n - ./bin/python -m lotrpc.clsrv server mp\n - ./bin/python -m lotrpc.clsrv client mp\n- grpc\n - ./bin/python -m lotrpc.clsrv server grpc --options '{\"source\":\"examples/grpc/hello.proto\"}'\n - ./bin/python -m lotrpc.clsrv client grpc --options '{\"source\":\"examples/grpc/hello.proto\"}' --method Greeter.SayHello --params '{\"name\":\"xyzxyz\"}'\n- zerorpc\n - ./bin/python -m lotrpc.clsrv server zero\n - ./bin/python -m lotrpc.clsrv client zero\n - ./bin/zerorpc --json tcp://localhost:9999 hello '{\"hello\":\"world\"}'\n\n## client usage (CLI)\n\n```\n# ./bin/python -m lotrpc.clsrv\nUsage: clsrv.py [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n benchmark start benchmark client\n client serialized client\n client-async client with asyncio\n client-pool client with thread pool\n client-ppool client with process pool\n listmode list rpc mode\n proxy start proxy server\n proxy-auth start proxy with authentication example\n server start server\n\n# ./bin/python -m lotrpc.clsrv client --help\nUsage: clsrv.py client [OPTIONS] [MODE] [ADDR]\n\n serialized client\n\nOptions:\n --options TEXT\n --num INTEGER\n --method TEXT\n --params TEXT\n --verbose / --no-verbose\n --help Show this message and exit.\n\n# ./bin/python -m lotrpc.clsrv client json http://localhost:9999/endpoint --method hello --params '{\"hello\":\"world\"}'\n\n# nc -l 9999\nPOST /endpoint HTTP/1.1\nHost: localhost:9999\nUser-Agent: python-requests/2.21.0\nAccept-Encoding: gzip, deflate\nAccept: */*\nConnection: keep-alive\ncontent-type: application/json\nContent-Length: 76\n\n{\"method\": \"hello\", \"params\": {\"hello\": \"world\"}, \"jsonrpc\": \"2.0\", \"id\": 0}\n```\n\n## client usage (Python)\n\n```python\nimport lotrpc\n\n# JSON RPC\ncl = lotrpc.json.Client(\"http://localhost:9999/endpoint\")\n\n# XML-RPC\ncl = lotrpc.xml.Client(\"http://localhost:9999/endpoint\")\n\n# MessagePack-RPC\ncl = lotrpc.msgpack.Client(\"http://localhost:9999/endpoint\")\n\n# ZeroRPC\ncl = lotrpc.zero.Client(\"http://localhost:9999/endpoint\")\n\n## call it\nres = cl.call(\"hello\", {\"hello\": \"world\"})\nprint(res)\n```\n\n## server(dispatcher) usage (Python)\n\n```python\nimport lotrpc\n\nclass HelloDispatcher(lotrpc.SimpleDispatcher):\n def do_hello(self, params):\n return {\"result\": \"OK1\"}\n\n def do_goodbye(self, params):\n return {\"result\": \"OK2\"}\n\n# JSON RPC\nsrv = lotrpc.json.Server(\"http://localhost:9999/endpoint\")\n\n# XML-RPC\nsrv = lotrpc.xml.Server(\"http://localhost:9999/endpoint\")\n\n# MessagePack-RPC\nsrv = lotrpc.msgpack.Server(\"http://localhost:9999/endpoint\")\n\n# ZeroRPC\nsrv = lotrpc.zero.Server(\"http://localhost:9999/endpoint\")\n\n## serve it\nsrv.serve(HelloDispatcher())\n```\n\n## proxy\n\n- (client) -> xmlrpc -(proxy)-> jsonrpc (server)\n - ./bin/python -m lotrpc.clsrv proxy xml http://localhost:9999/ json http://localhost:9998/\n - ./bin/python -m lotrpc.clsrv server json http://localhost:9998/\n - ./bin/python -m lotrpc.clsrv client xml http://localhost:9999/\n\n## does not work...\n\n- client\n - grpc + process pool\n - msgpack + thread pool, process pool, asyncio\n - xml + thread pool, process pool, asyncio\n - zero + thread pool, process pool, asyncio\n - aioxml + thread pool, process pool, asyncio\n- server\n - aioxml\n\n## TODO\n\n- Work in Progress\n - aiohttp_xmlrpc\n - Sun RPC\n - (for test) ./bin/python -m lotrpc.rpcgen\n- Golang net/rpc\n- BSON RPC\n- thrift\n- Java RMI\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": "https://github.com/wtnb75/lotrpc", "keywords": "rpc proxy grpc zerorpc json xml messagepack", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lotrpc", "package_url": "https://pypi.org/project/lotrpc/", "platform": "", "project_url": "https://pypi.org/project/lotrpc/", "project_urls": { "Homepage": "https://github.com/wtnb75/lotrpc" }, "release_url": "https://pypi.org/project/lotrpc/0.1.1/", "requires_dist": [ "msgpack-rpc-python", "requests", "tornado (<5)", "grpcio-tools", "grpcio", "click", "zerorpc", "mprpc", "Benchmarker", "ply", "bcrypt", "aiohttp-xmlrpc", "PyYAML", "jupyter ; extra == 'development'", "wheel ; extra == 'development'", "twine ; extra == 'development'" ], "requires_python": ">=3", "summary": "RPC abstraction layer", "version": "0.1.1" }, "last_serial": 4988282, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "77b5a0796cb1f7d92bad41dbdebb7e66", "sha256": "b823f67b61ec30f175e0a6640da9d88b08e67a2283f645069285d5c3c30fb632" }, "downloads": -1, "filename": "lotrpc-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "77b5a0796cb1f7d92bad41dbdebb7e66", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 23328, "upload_time": "2019-03-26T15:51:47", "url": "https://files.pythonhosted.org/packages/3c/e7/11acdfeb0b49f59207e6a10a3278b1b5fd6dd3b25fc62a555a78e1a83121/lotrpc-0.1.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "77b5a0796cb1f7d92bad41dbdebb7e66", "sha256": "b823f67b61ec30f175e0a6640da9d88b08e67a2283f645069285d5c3c30fb632" }, "downloads": -1, "filename": "lotrpc-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "77b5a0796cb1f7d92bad41dbdebb7e66", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 23328, "upload_time": "2019-03-26T15:51:47", "url": "https://files.pythonhosted.org/packages/3c/e7/11acdfeb0b49f59207e6a10a3278b1b5fd6dd3b25fc62a555a78e1a83121/lotrpc-0.1.1-py3-none-any.whl" } ] }