{ "info": { "author": "Aric Coady", "author_email": "aric.coady@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: AsyncIO", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Internet :: WWW/HTTP :: Session", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "[![image](https://img.shields.io/pypi/v/clients.svg)](https://pypi.org/project/clients/)\n[![image](https://img.shields.io/pypi/pyversions/clients.svg)](https://python3statement.org)\n![image](https://img.shields.io/pypi/status/clients.svg)\n[![image](https://img.shields.io/travis/coady/clients.svg)](https://travis-ci.org/coady/clients)\n[![image](https://img.shields.io/codecov/c/github/coady/clients.svg)](https://codecov.io/github/coady/clients)\n[![image](https://readthedocs.org/projects/clients/badge)](https://clients.readthedocs.io)\n[![image](https://requires.io/github/coady/clients/requirements.svg)](https://requires.io/github/coady/clients/requirements/)\n[![image](https://api.codeclimate.com/v1/badges/8e4159e02ab75e76af4f/maintainability)](https://codeclimate.com/github/coady/clients/maintainability)\n\nClients provide [requests](https://python-requests.org) and\n[aiohttp](http://aiohttp.readthedocs.io) wrappers which encourage best practices,\nparticularly always using Sessions to connect to the same host or api endpoint.\n\n# Usage\nTypical [requests](https://python-requests.org) usage is redundant and inefficient,\nby not taking advantage of connection pooling.\n\n```python\nr = requests.get('https://api.github.com/user', headers={'authorization': token})\nr = requests.get('https://api.github.com/user/repos', headers={'authorization': token})\n```\n\nUsing sessions is the better approach,\nbut more verbose and in practice requires manual url joining.\n\n```python\ns = requests.Session()\ns.headers['authorization'] = token\nr = s.get('https://api.github.com/user')\nr = s.get('https://api.github.com/user/repos')\n```\n\n## Client\nClients make using sessions easier, with implicit url joining.\n\n```python\nclient = clients.Client('https://api.github.com/', headers={'authorization': token})\nr = client.get('user')\nr = client.get('user/repos')\n```\n\nResources extend Clients to implicitly handle response content,\nwith proper checking of status_code and content-type.\n\n```python\ngithub = clients.Resource('https://api.github.com/', headers={'authorization': token})\nfor repo in github.get('user/repos', params={'visibility': 'public'}):\n ...\n```\n\n## Resource\nResources also implement syntactic support for methods such as __getattr__ and __call__,\nproviding most of the benefits of custom clients with no further defintion.\n\n```python\nfor repo in github.user.repos(visibility='public'):\n ...\n```\n\nBeing session based, Clients work seamlessly with other [requests](https://python-requests.org) adapters,\nsuch as [CacheControl](https://cachecontrol.readthedocs.org).\nAsynchronous variants of all client types are provided in [Python 3](https://python3statement.org),\nusing [aiohttp](http://aiohttp.readthedocs.io) instead of [requests](https://python-requests.org).\nAdditional clients for [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call),\n[GraphQL](http://graphql.org), and proxies also provided.\n\n# Installation\n\n $ pip install clients\n\n# Dependencies\n* requests >=2.4.2\n* aiohttp (if Python 3)\n\n# Tests\n100% branch coverage.\n\n $ pytest [--cov]\n\n# Changes\n1.0\n* Allow missing content-type\n* Oauth access tokens supported in authorization header\n\n0.5\n* `AsyncClient` default params\n* `Remote` and `AsyncRemote` procedure calls\n* `Graph` and `AsyncGraph` execute GraphQL queries\n* `Proxy` and `AsyncProxy` clients\n\n0.4\n* Asynchronous clients and resources\n\n0.3\n* `singleton` decorator\n\n0.2\n* Resource attribute upcasts back to a `client`\n* `iter` and `download` implement GET requests with streamed content\n* `create` implements POST request and returns Location header\n* `update` implements PATCH request with json params\n* `__call__` implements GET request with params\n\n\n", "description_content_type": "text/markdown", "docs_url": "https://pythonhosted.org/clients/", "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/coady/clients", "keywords": "requests sessions responses resources asyncio", "license": "Apache Software License", "maintainer": "", "maintainer_email": "", "name": "clients", "package_url": "https://pypi.org/project/clients/", "platform": "", "project_url": "https://pypi.org/project/clients/", "project_urls": { "Documentation": "https://clients.readthedocs.io", "Homepage": "https://github.com/coady/clients" }, "release_url": "https://pypi.org/project/clients/1.0/", "requires_dist": [ "requests (>=2.4.2)", "aiohttp ; python_version>=\"3.5\"" ], "requires_python": ">=2.7", "summary": "HTTP for humanitarians.", "version": "1.0" }, "last_serial": 4576284, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "2b3779e38abea78428f35e5b128cecdb", "sha256": "1f48af3fbd4aaefc1a6f54bcddae41c3e965bcf0c46a79eb0b7554e452774b6f" }, "downloads": -1, "filename": "clients-0.1.tar.gz", "has_sig": false, "md5_digest": "2b3779e38abea78428f35e5b128cecdb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12415, "upload_time": "2016-03-15T00:43:49", "url": "https://files.pythonhosted.org/packages/7f/43/e49fc9500fa5cf78edbf810b8b1a63dda146af36c2cd4ee1f24338416c13/clients-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "f348a17a5306567467f72149ee61d821", "sha256": "53859f4cfd83c4b2c3786c90eb5ed665a774101208c16460e1b16f53e79bc865" }, "downloads": -1, "filename": "clients-0.2.tar.gz", "has_sig": false, "md5_digest": "f348a17a5306567467f72149ee61d821", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13644, "upload_time": "2016-04-10T18:22:23", "url": "https://files.pythonhosted.org/packages/1e/e7/7d15bbd18ac3f32924afa896cb5e8e94fec1e3988c7f184a71c4683a7c25/clients-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "e6c8365bb1f051262551aaa07e10e2c5", "sha256": "3249cd768120a855326dd8bc5d2d35a517f703e13628a7aa5b5a2db0cbd0f5c9" }, "downloads": -1, "filename": "clients-0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e6c8365bb1f051262551aaa07e10e2c5", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 5695, "upload_time": "2017-01-02T23:02:03", "url": "https://files.pythonhosted.org/packages/19/69/4794608513bffc5dbcb2f1bff4decd2d9624413ac894944ab6a1aeb5924d/clients-0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f57adefec2292fa0ea47778728c9401d", "sha256": "1526d931a083d08a7032d6a7821ca214fb5f1b6b1d9b156e9d5ca07395311e54" }, "downloads": -1, "filename": "clients-0.3.tar.gz", "has_sig": false, "md5_digest": "f57adefec2292fa0ea47778728c9401d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13784, "upload_time": "2017-01-02T23:02:01", "url": "https://files.pythonhosted.org/packages/04/47/6ff039575d744222ebadbed8e8f377414090a2fe83aeebf31704dad550e2/clients-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "6b77bfb9f11c6e07b68aa8e7b33db7a4", "sha256": "9ee2b4b08ba6395c6e0124beaef4852d10053ca9d84a002750494905d5c3ab9b" }, "downloads": -1, "filename": "clients-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6b77bfb9f11c6e07b68aa8e7b33db7a4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7294, "upload_time": "2017-06-11T22:22:27", "url": "https://files.pythonhosted.org/packages/b0/42/1097d3040f9cada3bdec38826251d469269a0576bbaeabf9b6780f2bd818/clients-0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ef88e08116c02150718a13bc43aad347", "sha256": "f91707bb5cae852266b90c087fd84d16025ca842dd6b8293719db818e6fb674d" }, "downloads": -1, "filename": "clients-0.4.tar.gz", "has_sig": false, "md5_digest": "ef88e08116c02150718a13bc43aad347", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14980, "upload_time": "2017-06-11T22:22:28", "url": "https://files.pythonhosted.org/packages/fa/fc/0c046b9f0047fcb646ec2b88d5957c10179fff96a371eadb0c522842dd25/clients-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "07efe517b9a0914b149e2fa090362b3c", "sha256": "d8584ec6f85544e487d4cbb3c37e85aa4ea927e99b9bc865832a2c1990457a12" }, "downloads": -1, "filename": "clients-0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "07efe517b9a0914b149e2fa090362b3c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 10330, "upload_time": "2017-12-19T02:48:39", "url": "https://files.pythonhosted.org/packages/49/f1/df01e9eb46ec8d1b91c8dca3dcce00905b2ec1c85735db06fd8c4edb3831/clients-0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bae064cc730e4fb6e8f6705d880d383c", "sha256": "d4fbce724b4eca33564bee823aa3cae3e6adcfb52b954f0cb610f444cafe2642" }, "downloads": -1, "filename": "clients-0.5.tar.gz", "has_sig": false, "md5_digest": "bae064cc730e4fb6e8f6705d880d383c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 18129, "upload_time": "2017-12-19T02:48:41", "url": "https://files.pythonhosted.org/packages/1c/b9/d40e6cdc506b50cb0307a0c9c1fe8f646f0261c6ef1419254df74bff9d14/clients-0.5.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "fa8aa9b0b1dbf442d77fa41347ac2db8", "sha256": "905593b7a2a1bc4fcb1f214c141a93aa24940037bc8da88425a2133010e52227" }, "downloads": -1, "filename": "clients-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fa8aa9b0b1dbf442d77fa41347ac2db8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 9128, "upload_time": "2018-12-08T23:38:47", "url": "https://files.pythonhosted.org/packages/71/99/186f8d09548c70c30a6e4489b937ee3b615e9f7379c62217f9e157463577/clients-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3959cd8676dd02083b67d666f4cf82fe", "sha256": "72120e7ee43e348f6a9691a612eafcd3db29ab03d3e98dd76987396a4ad0a2c0" }, "downloads": -1, "filename": "clients-1.0.tar.gz", "has_sig": false, "md5_digest": "3959cd8676dd02083b67d666f4cf82fe", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 17547, "upload_time": "2018-12-08T23:38:49", "url": "https://files.pythonhosted.org/packages/01/be/886cbc7f03bb955e8c1a3fc46b07b63061147619de09d0ba3c88c4111f71/clients-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fa8aa9b0b1dbf442d77fa41347ac2db8", "sha256": "905593b7a2a1bc4fcb1f214c141a93aa24940037bc8da88425a2133010e52227" }, "downloads": -1, "filename": "clients-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fa8aa9b0b1dbf442d77fa41347ac2db8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 9128, "upload_time": "2018-12-08T23:38:47", "url": "https://files.pythonhosted.org/packages/71/99/186f8d09548c70c30a6e4489b937ee3b615e9f7379c62217f9e157463577/clients-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3959cd8676dd02083b67d666f4cf82fe", "sha256": "72120e7ee43e348f6a9691a612eafcd3db29ab03d3e98dd76987396a4ad0a2c0" }, "downloads": -1, "filename": "clients-1.0.tar.gz", "has_sig": false, "md5_digest": "3959cd8676dd02083b67d666f4cf82fe", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 17547, "upload_time": "2018-12-08T23:38:49", "url": "https://files.pythonhosted.org/packages/01/be/886cbc7f03bb955e8c1a3fc46b07b63061147619de09d0ba3c88c4111f71/clients-1.0.tar.gz" } ] }