{ "info": { "author": "Tom Christie", "author_email": "tom@tomchristie.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: Internet :: WWW/HTTP" ], "description": "**This work has been overtaken by the `http3` project:** https://www.encode.io/http3/\n\nWe now recommend using `http3.AsyncClient()` for async/await support with a requests-compatible API.\n\n**Note**: Use `ipython` to try this from the console, since it supports `await`.\n\n```python\n>>> import http3\n>>> client = http3.AsyncClient()\n>>> r = await client.get('https://www.example.org/')\n>>> r.status_code\n200\n>>> r.text\n'\\n\\n\\nExample Domain...'\n```\n\n---\n\n# requests-async\n\nBrings support for `async`/`await` syntax to Python's fabulous `requests` library.\n\n

\n\n \"Build\n\n\n \"Coverage\"\n\n\n \"Package\n\n

\n\n## Requirements\n\n* Python 3.6+\n\n## Installation\n\n```shell\n$ pip install requests-async\n```\n\n## Usage\n\nJust use *the standard requests API*, but use `await` for making requests.\n\n**Note**: Use `ipython` to try this from the console, since it supports `await`.\n\n```python\nimport requests_async as requests\n\n\nresponse = await requests.get('https://example.org')\nprint(response.status_code)\nprint(response.text)\n```\n\nOr use explicit sessions, with an async context manager.\n\n```python\nimport requests_async as requests\n\n\nasync with requests.Session() as session:\n response = await session.get('https://example.org')\n print(response.status_code)\n print(response.text)\n```\n\nThe `requests_async` package subclasses `requests`, so you're getting all the\nstandard behavior and API you'd expect.\n\n## Streaming responses & requests\n\nThe `iter_content()` and `iter_lines()` methods are async iterators.\n\n```python\nresponse = await requests.get('https://example.org', stream=True)\nasync for chunk in response.iter_content():\n ...\n```\n\nThe method signatures remain the same as the standard `requests` API:\n\n* `iter_content(chunk_size=1, decode_unicode=False)`\n* `iter_lines(chunk_size=512, decode_unicode=False, delimiter=None)`\n\nThe methods will yield text if `decode_unicode` is set and the response includes\nan encoding. Otherwise the methods will yield bytes.\n\nYou can also stream request bodies. To do this you should use an asynchronous\ngenerator that yields bytes.\n\n```python\nasync def stream_body():\n ...\n\nresponse = await requests.post('https://example.org', data=stream_body())\n```\n\n## Mock Requests\n\nIn some situations, such as when you're testing a web application, you may\nnot want to make actual outgoing network requests, but would prefer instead\nto mock out the endpoints.\n\nYou can do this using the `ASGISession`, which allows you to plug into\nany ASGI application, instead of making actual network requests.\n\n```python\nimport requests_async\n\n#\u00a0Create a mock service, with Starlette, Responder, Quart, FastAPI, Bocadillo,\n# or any other ASGI web framework.\nmock_app = ...\n\nif TESTING:\n #\u00a0Issue requests to the mocked application.\n requests = requests_async.ASGISession(mock_app)\nelse:\n # Make live network requests.\n requests = requests_async.Session()\n```\n\n## Test Client\n\nYou can also use `ASGISession` as a test client for any ASGI application.\n\nYou'll probably want to install `pytest` and `pytest-asyncio`, or something\nequivalent, to allow you to write `async` test cases.\n\n```python\nfrom requests_async import ASGISession\nfrom myproject import app\nimport pytest\n\n@pytest.mark.asyncio\nasync def test_homepage():\n client = ASGISession(app)\n response = await client.get(\"/\")\n assert response.status_code == 200\n```\n\n## Alternatives\n\n* The [`http3` package][http3] both sync and async HTTP clients, with a requests-compatible API.\n* The [`aiohttp` package][aiohttp] provides an alternative client for making async HTTP requests.\n\n[issues]: https://github.com/encode/requests-async/issues\n[aiohttp]: https://docs.aiohttp.org/en/stable/client.html\n[http3]: https://github.com/encode/http3", "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/encode/requests-async", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "requests-async", "package_url": "https://pypi.org/project/requests-async/", "platform": "", "project_url": "https://pypi.org/project/requests-async/", "project_urls": { "Homepage": "https://github.com/encode/requests-async" }, "release_url": "https://pypi.org/project/requests-async/0.6.2/", "requires_dist": null, "requires_python": ">=3.6", "summary": "async-await support for `requests`.", "version": "0.6.2" }, "last_serial": 5430712, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "3898bc905949398ca5f68170681ea546", "sha256": "e2fac862c50664bebab912f469ee17619f6b899226627daf22f6b0ca0a59fb42" }, "downloads": -1, "filename": "requests-async-0.0.1.tar.gz", "has_sig": false, "md5_digest": "3898bc905949398ca5f68170681ea546", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 5357, "upload_time": "2019-03-21T11:26:12", "url": "https://files.pythonhosted.org/packages/66/36/662d6f8ed179bd16ee8837dcdaca15ba701371c4842fdaf7a73b3e31319d/requests-async-0.0.1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "80cacbd755bd901b56666354375da76f", "sha256": "567e4b5f164527ab367ecfa9e78b5e0ecefb93c475f67246f251fd6a1808d09c" }, "downloads": -1, "filename": "requests-async-0.1.0.tar.gz", "has_sig": false, "md5_digest": "80cacbd755bd901b56666354375da76f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 7100, "upload_time": "2019-03-21T14:19:45", "url": "https://files.pythonhosted.org/packages/25/4c/a22cbdf1c710637c62e90148e75f8a4e850189d8a646a5948e15eb8e06e8/requests-async-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "b16069a9bee39bf6958901c7f8373560", "sha256": "0363d7875fa80324087524777becee2ecced98490301d215cf89a795a1a43cb9" }, "downloads": -1, "filename": "requests-async-0.1.1.tar.gz", "has_sig": false, "md5_digest": "b16069a9bee39bf6958901c7f8373560", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 10945, "upload_time": "2019-03-21T17:08:12", "url": "https://files.pythonhosted.org/packages/93/c1/6bd0c506b0705fee23f4fcbf3b34495164066972f0b170f5f0ab435c9ba5/requests-async-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "7e9062aaf57d3bf70c17a1762b643ac3", "sha256": "a7cb1a684fb47c77e5581af956183493ec79074d6dba6eb9c031a5a5b7b421d5" }, "downloads": -1, "filename": "requests-async-0.1.2.tar.gz", "has_sig": false, "md5_digest": "7e9062aaf57d3bf70c17a1762b643ac3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 11126, "upload_time": "2019-03-22T10:41:22", "url": "https://files.pythonhosted.org/packages/c5/8f/76c0843e055208b8b39eefaa807c5990a587bb7b97309c301efd38f6e858/requests-async-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "8141b32bf6ee6155f4ac541a68f06236", "sha256": "f7dcd294d3ebdbd897013b398f466e5204b717cfdfc562df03dae1f50d1a71a4" }, "downloads": -1, "filename": "requests-async-0.1.3.tar.gz", "has_sig": false, "md5_digest": "8141b32bf6ee6155f4ac541a68f06236", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 11239, "upload_time": "2019-03-22T15:40:59", "url": "https://files.pythonhosted.org/packages/7d/18/200eab41f65d31b81a8ea20892f2f4b6dfce0e6a6c8fceb69a40f3ec4d9e/requests-async-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "c7c29e6f4715d2640e490f2a380a0ec5", "sha256": "b337f133532cee775143bdf5d53bd3427ba00ae132cd64cbdf572a4eecdf4c7f" }, "downloads": -1, "filename": "requests-async-0.1.4.tar.gz", "has_sig": false, "md5_digest": "c7c29e6f4715d2640e490f2a380a0ec5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 11267, "upload_time": "2019-03-26T11:25:41", "url": "https://files.pythonhosted.org/packages/e1/bd/0a356239cbd84a02d05ce01b12bf4a9ce4f31270da58b651ffe79ce4caab/requests-async-0.1.4.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "614afa2b1d03297a4c85069d1e1919b8", "sha256": "e7e81cac0bddc413a0125e144ad8403b11d369d5a99f56e97444785f77222ced" }, "downloads": -1, "filename": "requests-async-0.2.0.tar.gz", "has_sig": false, "md5_digest": "614afa2b1d03297a4c85069d1e1919b8", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 11406, "upload_time": "2019-03-26T14:55:52", "url": "https://files.pythonhosted.org/packages/48/83/6a1d0d24bc826e82c1c79380bb1970d70bcbf0ef4a4200aaa6bd85aecc50/requests-async-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "323c934ab5718e3f17b16fba0e4d6ebd", "sha256": "12ce910ef0f7689ac8e86e3f2539446b3f248bff64b83706dfdb4d9e2a61ea7b" }, "downloads": -1, "filename": "requests-async-0.3.0.tar.gz", "has_sig": false, "md5_digest": "323c934ab5718e3f17b16fba0e4d6ebd", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 11361, "upload_time": "2019-04-18T15:16:59", "url": "https://files.pythonhosted.org/packages/42/16/149fb5ac8ea4a188350730f487dc8c726d8f35c37a9ba3b392751eb045c5/requests-async-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "b0b125a7e959c272387bdb80ddc1e5dd", "sha256": "9b74e990173957f4c532825f2312d7bae642fa7801d76b483f2e84b18a09658b" }, "downloads": -1, "filename": "requests-async-0.3.1.tar.gz", "has_sig": false, "md5_digest": "b0b125a7e959c272387bdb80ddc1e5dd", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12209, "upload_time": "2019-04-19T10:57:09", "url": "https://files.pythonhosted.org/packages/85/43/fe8aaaf93bd62905f39a91544eff961e697bc639c385d45ce6c82de294f4/requests-async-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "a900f48eb3ec623d26f8adf0fcb3f7c1", "sha256": "cccb4ac673dd21011249926f45a24606af930dfb333f0b17b2b4d4d0fef8a45e" }, "downloads": -1, "filename": "requests-async-0.4.0.tar.gz", "has_sig": false, "md5_digest": "a900f48eb3ec623d26f8adf0fcb3f7c1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12365, "upload_time": "2019-04-20T09:32:22", "url": "https://files.pythonhosted.org/packages/24/6d/255aa6d2b158ab8eba8108c4c1aafa608d84521dd2738d61069f5c9905e9/requests-async-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "6957cdd288cc02b2895a45eb5379c408", "sha256": "484221fb41ccc47b475cdc2634b37884ca78ca291160664e9b8b8c5e53fdd4af" }, "downloads": -1, "filename": "requests-async-0.4.1.tar.gz", "has_sig": false, "md5_digest": "6957cdd288cc02b2895a45eb5379c408", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12364, "upload_time": "2019-04-24T11:01:52", "url": "https://files.pythonhosted.org/packages/78/36/d0334ed63c3e77e44fa5d3dc4f87658e3a5f9c83b28d5ef6b2708abf3037/requests-async-0.4.1.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "313751f07328d5fa7cfe7d703cd82d8d", "sha256": "8731420451383196ecf2fd96082bfc8ae5103ada90aba185888499d7784dde6f" }, "downloads": -1, "filename": "requests-async-0.5.0.tar.gz", "has_sig": false, "md5_digest": "313751f07328d5fa7cfe7d703cd82d8d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12371, "upload_time": "2019-05-16T12:06:09", "url": "https://files.pythonhosted.org/packages/91/b9/ffa57f36253752084c3824d06d7960d58ccfecc3978fd7336e4117bdbd4b/requests-async-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "0055258b2ee4d308582d390893e44986", "sha256": "bb802d70fbe4cdd2a823f333138c7679f0cbeb7822083380f3791f5bd8d9bd71" }, "downloads": -1, "filename": "requests-async-0.6.0.tar.gz", "has_sig": false, "md5_digest": "0055258b2ee4d308582d390893e44986", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12428, "upload_time": "2019-06-18T10:35:21", "url": "https://files.pythonhosted.org/packages/e8/43/68fa7f3333b33ab393ee8451a100b7b57d53b9d087ee1243e2520158a3b6/requests-async-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "b32283c5dc7ec2c49943eb57c4c3f627", "sha256": "3bfdd7f4b4d24ae86c0382c6da90ba704e9629b9d803f6f79d2feb39a480f3c0" }, "downloads": -1, "filename": "requests-async-0.6.1.tar.gz", "has_sig": false, "md5_digest": "b32283c5dc7ec2c49943eb57c4c3f627", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12848, "upload_time": "2019-06-21T10:11:33", "url": "https://files.pythonhosted.org/packages/d9/3a/0172435fa886d658e31741ea509fbb0c0d6209b1df13657c2450667dc2ef/requests-async-0.6.1.tar.gz" } ], "0.6.2": [ { "comment_text": "", "digests": { "md5": "b03f7a535f906eaef28439b8d744d726", "sha256": "8f128b66dec2974aa263e24410914b1829d3e1506497364c2edfa10112f55e0b" }, "downloads": -1, "filename": "requests-async-0.6.2.tar.gz", "has_sig": false, "md5_digest": "b03f7a535f906eaef28439b8d744d726", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12856, "upload_time": "2019-06-21T12:52:21", "url": "https://files.pythonhosted.org/packages/4a/e7/afbe47fa17068c80a5e80d75e1e960a98a5cfefe3590108ba76d9560cefc/requests-async-0.6.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b03f7a535f906eaef28439b8d744d726", "sha256": "8f128b66dec2974aa263e24410914b1829d3e1506497364c2edfa10112f55e0b" }, "downloads": -1, "filename": "requests-async-0.6.2.tar.gz", "has_sig": false, "md5_digest": "b03f7a535f906eaef28439b8d744d726", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 12856, "upload_time": "2019-06-21T12:52:21", "url": "https://files.pythonhosted.org/packages/4a/e7/afbe47fa17068c80a5e80d75e1e960a98a5cfefe3590108ba76d9560cefc/requests-async-0.6.2.tar.gz" } ] }