{ "info": { "author": "alfred82santa", "author_email": "alfred82santa@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "|travis-master| |coverall-master| |doc-master| |pypi-downloads| |pypi-lastrelease| |python-versions|\n|project-status| |project-license| |project-format| |project-implementation|\n\n.. |travis-master| image:: https://travis-ci.org/alfred82santa/aio-service-client.svg?branch=master\n :target: https://travis-ci.org/alfred82santa/aio-service-client\n\n.. |coverall-master| image:: https://coveralls.io/repos/alfred82santa/aio-service-client/badge.svg?branch=master&service=github\n :target: https://coveralls.io/r/alfred82santa/aio-service-client?branch=master\n\n.. |doc-master| image:: https://readthedocs.org/projects/aio-service-client/badge/?version=latest\n :target: http://aio-service-client.readthedocs.io/?badge=latest\n :alt: Documentation Status\n\n.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/aio-service-client.svg\n :target: https://pypi.python.org/pypi/aio-service-client/\n :alt: Downloads\n\n.. |pypi-lastrelease| image:: https://img.shields.io/pypi/v/aio-service-client.svg\n :target: https://pypi.python.org/pypi/aio-service-client/\n :alt: Latest Version\n\n.. |python-versions| image:: https://img.shields.io/pypi/pyversions/aio-service-client.svg\n :target: https://pypi.python.org/pypi/aio-service-client/\n :alt: Supported Python versions\n\n.. |project-status| image:: https://img.shields.io/pypi/status/aio-service-client.svg\n :target: https://pypi.python.org/pypi/aio-service-client/\n :alt: Development Status\n\n.. |project-license| image:: https://img.shields.io/pypi/l/aio-service-client.svg\n :target: https://pypi.python.org/pypi/aio-service-client/\n :alt: License\n\n.. |project-format| image:: https://img.shields.io/pypi/format/aio-service-client.svg\n :target: https://pypi.python.org/pypi/aio-service-client/\n :alt: Download format\n\n.. |project-implementation| image:: https://img.shields.io/pypi/implementation/aio-service-client.svg\n :target: https://pypi.python.org/pypi/aio-service-client/\n :alt: Supported Python implementations\n\n\n========================\nService Client Framework\n========================\n\nService Client Framework powered by Python asyncio.\n\nThe easiest way to implement a client to work with a service REST API.\n\nFeatures\n========\n\n- Easy way to make request to service.\n- AsyncIO implementation using aiohttp.\n- Powerful plugin system.\n- Useful plugins.\n- Mock plugin in order to make tests.\n- Opensource license: GNU LGPLv3\n\nInstallation\n============\n\n.. code-block:: bash\n\n $ pip install aio-service-client\n\nGetting started\n===============\n\nService client framework is used to call HTTP service API's. So, you must define how to\ncommunicate with this service API defining its endpoint:\n\n.. code-block:: python\n\n spec = {\"get_users\": {\"path\": \"/user\",\n \"method\": \"get\"},\n \"get_user_detail\": {\"path\": \"/user/{user_id}\",\n \"method\": \"get\"},\n \"create_user\": {\"path\": \"/user\",\n \"method\": \"post\"},\n \"update_user\": {\"path\": \"/user/{user_id}\",\n \"method\": \"put\"}}\n\nImagine you are using a Rest JSON API in order to manage users. So, your data must be sent\nas a JSON and response must be a JSON string. It mean you must serialize every request payload\nto a JSON, and parse every response as JSON. So, you only need to define JSON parser and serializer\nfor your service:\n\n.. code-block:: python\n\n service = ServiceClient(spec=spec,\n plugins=[PathToken()],\n base_path=\"http://example.com\",\n parser=json_decoder,\n serializer=json_encoder)\n\nSo, you are ready to make request to service API:\n\n.. code-block:: python\n\n resp = yield from service.call(\"get_users\")\n # it could be called directly\n # resp = yield from service.get_users()\n\n # if response is like:\n # {\"users\": {\"item\": [{\"userId\": \"12\", \"username\": \"foo\"}, {\"userId\": \"13\", \"username\": \"bar\"}], \"count\": 2}\n print(\"Count: %d\" % resp.data['users']['count'])\n for user in resp.data['users']['items']:\n print(\"User `%s`: %s\" % (user['userId'], user['username']))\n\nIn order to send a payload you must use ``payload`` keyword on call:\n\n.. code-block:: python\n\n resp = yield from service.call(\"create_user\", payload={\"username\": \"foobar\"})\n # it could be called directly\n # resp = yield from service.create_user(payload={\"username\": \"foobar\"})\n\n # it will make a request like:\n # POST http://example.com/user\n #\n # {\"username\": \"foobar\"}\n\n\nChangelog\n=========\n\nv0.6.1\n------\n\n- Pool plugin now add ``blocked_by_pool`` attribute to session containing elapsed time (seconds) on pool. It allows\n to log this time using log plugins.\n\n- RateLimit plugin now add ``blocked_by_ratelimit`` attribute to session containing elapsed time (seconds) blocked by\n rate limit. It allows to log this time using log plugins.\n\n- Tests improved.\n\n- Added new exceptions: :class:`~service_client.plugins.TooManyRequestsPendingError` and\n :class:`~service_client.plugins.TooMuchTimePendingError`.\n\n- Added decorator in order to help to build service clients. It allows to define a method using a request model\n but to call it using keywords to build request model which will be used to call method.\n\n.. code-block:: python\n\n class RequestModel:\n def __init__(param_1=None):\n self.param_1 = param_1\n\n\n class Service:\n\n @build_parameter_object\n async def method_1(request: RequestModel):\n return do_something(request)\n\n\n serv = Service()\n await serv.method_1(param_1=23)\n\nv0.6.0\n------\n\n- Improved Pool plugin. It now allows to set hard limit of pending requests, if it reach limit requests will\n fail raising :class:`RequestLimitError`. In same way, it allows to set a timeout, in seconds, for pending requests and\n it will raise same exception.\n\n- Added new RateLimit plugin. It is similar to Pool plugin but using a period parameter, in seconds, in order to limit number\n of request in this period.\n\n- Improved error logging.\n\n- Added new hook ``close`` in order to notify plugins that client is going to close.\n\n- Removed compatibility with Python 3.4.\n\n\nv0.5.4\n------\n\n- Made compatible with aiohttp 2.0.x.\n\nv0.5.2\n------\n\n- Made compatible with aiohttp 1.0.x.\n- Simplified factory code.\n\nv0.5.1\n------\n\n- Resolved problem with requests streamed.\n\nv0.5.0\n------\n\n- Added factories\n- Added spec loaders\n\nv0.4.1\n------\n\n- Fix elapsed data on logs.\n\nv0.4.0\n------\n\n- Added new ``Pool`` plugin.\n- Improved ``Elapsed`` plugin.\n- Added new hook in order to allow plugins to override response methods.\n\nv0.3.1\n------\n\n- Fix response when using Timeout plugin.\n\nv0.3.0\n------\n\n- Added TrackingToken plugin. Token is added to session and to response.\n- Added a log formatter.\n- Removed tracking token stuff from log plugins.\n- Improved log plugins. They avoid to print body if it is streamed or must be hidden.\n- Improved session wrapper.\n\nPlugins\n=======\n\nPathTokens\n----------\n\nIt allows to fill placeholders on path in order to build uri.\n\n.. code-block:: python\n\n service = ServiceClient(spec={\"endpoint1\": {\"method\": \"get\",\n \"path\": \"/endpoint/{placeholder1}/{placeholder2}\"}},\n plugins=[PathToken()],\n base_path=\"http://example.com\")\n\n resp = yield from service.call(\"endpoint1\", placeholder1=21, placeholder1=\"foo\")\n # It will make request:\n # GET http://example.com/endpoint/21/foo\n\n\nHeaders\n-------\n\nIt allows to define default headers, endpoint headers and request headers.\n\n\n.. code-block:: python\n\n service = ServiceClient(spec={\"endpoint1\": {\"method\": \"get\",\n \"path\": \"/endpoint/foo/bar\",\n \"headers\": {\"X-fake-header\": \"header; data\"}}},\n plugins=[Headers(headers={\"content-type\": \"application/json\"})],\n base_path=\"http://example.com\")\n\n resp = yield from service.call(\"endpoint1\", headers={\"X-other-fake-header\": \"foo\"})\n # It will make request:\n # GET http://example.com/endpoint/foo/bar\n # X-fake-header: header; data\n # content-type: application/json\n # X-other-fake-header: foo\n\nTimeout\n-------\n\nIt allows to define default timeout for service request, endpoint or request.\n\nElapsed\n-------\n\nIt adds elapsed time to response.\n\nTrackingToken\n-------------\n\nIt allows to assign a token for each pair request/response in order to identify them.\n\nQueryParams\n-----------\n\nIt allows to use query parameters on request. They could be defined at service client, endpoint or request.\n\nInnerLogger\n-----------\n\nIt allows to log request after serialize and response before parse.\n\nOuterLogger\n-----------\n\nIt allows to log request before serialize and response after parse.\n\nPool\n----\n\nIt allows to limit concurrent requests. Besides it allows to set a hard limit of pending requests and a timeout\nfor blocked ones.\n\nRateLimit\n---------\n\nIt allows to limit number of requests in a time period. Besides it allows to set a hard limit of\npending requests and a timeout for blocked ones.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/alfred82santa/aio-service-client", "keywords": "", "license": "LGPLv3", "maintainer": "", "maintainer_email": "", "name": "aio-service-client", "package_url": "https://pypi.org/project/aio-service-client/", "platform": "", "project_url": "https://pypi.org/project/aio-service-client/", "project_urls": { "Homepage": "https://github.com/alfred82santa/aio-service-client" }, "release_url": "https://pypi.org/project/aio-service-client/0.7.0/", "requires_dist": null, "requires_python": "", "summary": "Service Client Framework powered by Python asyncio.", "version": "0.7.0" }, "last_serial": 3729973, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "c4e9006fbf1d68ef02a63fbdeb5b39ec", "sha256": "9e55702b5ae61d47a2d7e23e3f1f0811f20d4042d14c0dd7bb1e4bc2ddd81eb5" }, "downloads": -1, "filename": "aio-service-client-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c4e9006fbf1d68ef02a63fbdeb5b39ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4195, "upload_time": "2016-04-29T07:21:24", "url": "https://files.pythonhosted.org/packages/a6/0f/f54763e77286d171c155d8e8688ee4730eb5ef662723064d66033d691a5a/aio-service-client-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "e3d4d6424d2e5f5d1fb162beccd1e925", "sha256": "c1e94327f7bdfec41a0b586a4f3c5704b5a6e7e43a4e909e219566aad31dcdaa" }, "downloads": -1, "filename": "aio-service-client-0.1.1.tar.gz", "has_sig": false, "md5_digest": "e3d4d6424d2e5f5d1fb162beccd1e925", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4187, "upload_time": "2016-04-29T08:43:15", "url": "https://files.pythonhosted.org/packages/20/54/42a3dc5109d54a0a2210d2991216ca3f3d24a15fb890121db3a096c440a4/aio-service-client-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "e18ad19995750ac14105120a0ce93f5c", "sha256": "635f61413d685f4080eccec770b6b2989515d0548c6a538543ea2215eabce4c0" }, "downloads": -1, "filename": "aio-service-client-0.1.2.tar.gz", "has_sig": false, "md5_digest": "e18ad19995750ac14105120a0ce93f5c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4212, "upload_time": "2016-04-29T09:47:51", "url": "https://files.pythonhosted.org/packages/27/6c/daf5d7e13a8765fbd066ed5134c78e9efe5bdcf1b32ca80a5a807920a213/aio-service-client-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "033eb2410faccaaf0cab1741732e29e8", "sha256": "a74dec207b75bd7eaac8fb05bfbd11f07496df7368d467f51bb222da9168cd21" }, "downloads": -1, "filename": "aio-service-client-0.1.3.tar.gz", "has_sig": false, "md5_digest": "033eb2410faccaaf0cab1741732e29e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4533, "upload_time": "2016-05-02T09:27:33", "url": "https://files.pythonhosted.org/packages/95/66/cbb7db3280b4d4ca81850d14cbaceb7d63116dd0ca8512753d572a2d7a3b/aio-service-client-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "b264862a246c797afb6a7e751016a9b2", "sha256": "ea9d4eb0f202828f0f376bbe59a1a7916ad9428bf5fcdeed6389aafb5d4c450e" }, "downloads": -1, "filename": "aio-service-client-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b264862a246c797afb6a7e751016a9b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8561, "upload_time": "2016-05-23T21:42:53", "url": "https://files.pythonhosted.org/packages/0d/75/094c737db072c4df46f7a245416f6573fc5013dbefa188d4ec9480d379f6/aio-service-client-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "80eb59d5081156b4cf2390db4714dc5d", "sha256": "b67d93397a1fbb839cf28001ee79739001270bdad4e87a8d22363a98a25b5f36" }, "downloads": -1, "filename": "aio-service-client-0.3.0.tar.gz", "has_sig": false, "md5_digest": "80eb59d5081156b4cf2390db4714dc5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9682, "upload_time": "2016-05-26T13:01:56", "url": "https://files.pythonhosted.org/packages/6c/f9/3aebf5b78a8f0d26ad4bcddc8d8229721b7e67f653e6b86f333295f18b10/aio-service-client-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "1a8be0fd6c0131c9834047e28e45527c", "sha256": "d6d3671b6a51e73dcf7edad9892bfd12f66a7f1a1d837594ef00b599b99ff322" }, "downloads": -1, "filename": "aio-service-client-0.3.1.tar.gz", "has_sig": false, "md5_digest": "1a8be0fd6c0131c9834047e28e45527c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9713, "upload_time": "2016-05-26T18:28:16", "url": "https://files.pythonhosted.org/packages/e5/d4/5e3b084e2425c3803778cb3f054cf5967be9966f547a39a4f230fa294988/aio-service-client-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "0d88ff1c525cfd37c11ed23faf7a8bfd", "sha256": "fdb537ff5a82c71e1f4f69162d1d37cf3e2be99b3ce063369d5537feb7c7f7bb" }, "downloads": -1, "filename": "aio-service-client-0.4.0.tar.gz", "has_sig": false, "md5_digest": "0d88ff1c525cfd37c11ed23faf7a8bfd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10384, "upload_time": "2016-05-28T23:53:42", "url": "https://files.pythonhosted.org/packages/75/2c/d1363b5b938e9dd678358656b76edc8a32bfd250cc82680db062cb587ee7/aio-service-client-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "79dd08d9336e1c832c9217f84753433f", "sha256": "75c5f0da278008e1845aa75091277966013834d4f35419ae5f65dee74a87cdfd" }, "downloads": -1, "filename": "aio-service-client-0.4.1.tar.gz", "has_sig": false, "md5_digest": "79dd08d9336e1c832c9217f84753433f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10426, "upload_time": "2016-05-29T01:24:20", "url": "https://files.pythonhosted.org/packages/af/59/7e7bfeb43ca28e013818afcb4f997f112bf982770294ff1dc1f3275eaa63/aio-service-client-0.4.1.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "5516aa5eec8dcbe39827aa6ae5881afe", "sha256": "9b34152f397e66f01886a713fabad1ec68b2208ab56b0ce6dba6f337fe2b8470" }, "downloads": -1, "filename": "aio-service-client-0.5.0.tar.gz", "has_sig": false, "md5_digest": "5516aa5eec8dcbe39827aa6ae5881afe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11037, "upload_time": "2016-06-07T08:26:11", "url": "https://files.pythonhosted.org/packages/f3/82/8f75ba1345571e49798d9d11f3e70d9ba484b151acdb78d99f860ab46c44/aio-service-client-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "265c89d582d204c90fff1074cd6ff8b9", "sha256": "3af9775fa18fb9f62ea0818c69c3bac07e2e99b908e4907b29b86b5b8ff9cc10" }, "downloads": -1, "filename": "aio-service-client-0.5.1.tar.gz", "has_sig": false, "md5_digest": "265c89d582d204c90fff1074cd6ff8b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11082, "upload_time": "2016-06-09T16:20:20", "url": "https://files.pythonhosted.org/packages/b5/98/1467f4bdb97b6fa1869e8a6e34fed6cc342d72fe59e1295195250e273fb3/aio-service-client-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "dfbae456192330300d040b9abfc0d7ca", "sha256": "fa26eae08030408822e542d68d60d9c2cd7e5266b07f5816291e5b7daafc2ee8" }, "downloads": -1, "filename": "aio-service-client-0.5.2.tar.gz", "has_sig": false, "md5_digest": "dfbae456192330300d040b9abfc0d7ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11137, "upload_time": "2016-10-10T19:29:53", "url": "https://files.pythonhosted.org/packages/21/b9/295c30257ae630691e195a16a5b6d071d4bca460c8ffb94b7af50b42fdc8/aio-service-client-0.5.2.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "c0b514d1c1790bed19c8f6eb80e9985f", "sha256": "83c8bda668046255dd8b50c6f1002e99d432b47476389cfcac8602df71664312" }, "downloads": -1, "filename": "aio-service-client-0.5.3.tar.gz", "has_sig": false, "md5_digest": "c0b514d1c1790bed19c8f6eb80e9985f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11484, "upload_time": "2016-11-10T20:42:21", "url": "https://files.pythonhosted.org/packages/9e/4c/3a82ba333de0cf026475e3884141aebc752cf392646a586cee3d1ebeed26/aio-service-client-0.5.3.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "f30c9269ad22e42fca97e2705fa83809", "sha256": "990b78b3aaf9c60854a89ea97c9ae6c932a421e57361a4aa7d68292f86e71d08" }, "downloads": -1, "filename": "aio-service-client-0.5.4.tar.gz", "has_sig": false, "md5_digest": "f30c9269ad22e42fca97e2705fa83809", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11493, "upload_time": "2017-04-26T20:56:57", "url": "https://files.pythonhosted.org/packages/96/a6/68a561eb4c088f9afab5b5511a2aef514b9bd9aa62688d50e5c1a7d70cd1/aio-service-client-0.5.4.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "5da7e097fb8eebf75f1141888b14a4a2", "sha256": "f86d8f97b3b50b528f1814536b56dfc940533a48f24d86f59542841597f19018" }, "downloads": -1, "filename": "aio-service-client-0.6.0.tar.gz", "has_sig": false, "md5_digest": "5da7e097fb8eebf75f1141888b14a4a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12287, "upload_time": "2017-05-15T21:38:12", "url": "https://files.pythonhosted.org/packages/5a/12/5c0262e7073d53e68530bc894abf61eddbcfe8306dc900e1040677eaa40b/aio-service-client-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "29b4dccab22a46bf3de14fe8bff3cba9", "sha256": "9f106420a78f423590aaa7d4ff674f014fadf378e73a3a8649c6313f384d8311" }, "downloads": -1, "filename": "aio-service-client-0.6.1.tar.gz", "has_sig": false, "md5_digest": "29b4dccab22a46bf3de14fe8bff3cba9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13354, "upload_time": "2017-05-17T12:07:33", "url": "https://files.pythonhosted.org/packages/7b/dd/8f4092e9eaa0bd5c580c599895ed47e76fb09dcf403d9ed97e8383dc1c75/aio-service-client-0.6.1.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "f517489ddfafa4e3cd4e05ad256578fe", "sha256": "1df4d706292c750f2ecb007dbd636f46cfe1a615a0dc964433cc7d1945bf9c9c" }, "downloads": -1, "filename": "aio-service-client-0.7.0.tar.gz", "has_sig": false, "md5_digest": "f517489ddfafa4e3cd4e05ad256578fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13446, "upload_time": "2018-04-03T15:17:12", "url": "https://files.pythonhosted.org/packages/56/b2/68b70be6db5e216158dacd84836142182d3f8e3def588ad1e1d66dfc3fba/aio-service-client-0.7.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f517489ddfafa4e3cd4e05ad256578fe", "sha256": "1df4d706292c750f2ecb007dbd636f46cfe1a615a0dc964433cc7d1945bf9c9c" }, "downloads": -1, "filename": "aio-service-client-0.7.0.tar.gz", "has_sig": false, "md5_digest": "f517489ddfafa4e3cd4e05ad256578fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13446, "upload_time": "2018-04-03T15:17:12", "url": "https://files.pythonhosted.org/packages/56/b2/68b70be6db5e216158dacd84836142182d3f8e3def588ad1e1d66dfc3fba/aio-service-client-0.7.0.tar.gz" } ] }