# Eidolon
A utility to concurrently make HTTP requests, with an optional rate limit. Powered by asyncio and aiohttp.
## Installation
Install and update via [pip](https://pip.pypa.io/en/stable/getting-started/)
```bash
pip install --U eidolon
```
## A Simple Example
```py3
import asyncio
import logging
from eidolon import Parallelizer
from eidolon.api_request import APIRequest
"""
the callback should ideally be an async function, since methods
like .json or .text on the response are async
"""
async def callback(request, response):
print(response.status)
print(await response.text())
"""
Create an APIRequest object. Each object corresponds to a single request, and can take in an optional callback
Everything except request_method and request_url is optional
"""
req = APIRequest(
request_method="GET",
request_url="https://www.google.com",
request_headers={"User-Agent": "Mozilla/5.0"},
request_params={"q": "python"},
request_json={"key": "value"},
request_form_data={"key": "value"},
callback=callback,
)
p = Parallelizer(
logging_level=logging.INFO, # default: logging.ERROR
max_requests_per_second=10, # default: 1
max_retry_attempts=1, # default: 3
seconds_to_sleep_after_rate_limit_error=10, # default: 15
)
# make 100 requests
asyncio.run(p.make_requests([req] * 100))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/SphericalKat/eidolon",
"name": "eidolon",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "asyncio,aiohttp,http,requests,concurrency,rate-limit",
"author": "Sphericalkat",
"author_email": "amolele@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d8/41/23ccaaac864a9b7d48553eb10fa13a8d2b87bcdd081130c384ef7473caa0/eidolon-0.1.4.tar.gz",
"platform": null,
"description": "# Eidolon\nA utility to concurrently make HTTP requests, with an optional rate limit. Powered by asyncio and aiohttp.\n\n## Installation\nInstall and update via [pip](https://pip.pypa.io/en/stable/getting-started/)\n```bash\npip install --U eidolon\n```\n\n## A Simple Example\n```py3\nimport asyncio\nimport logging\nfrom eidolon import Parallelizer\nfrom eidolon.api_request import APIRequest\n\n\"\"\"\nthe callback should ideally be an async function, since methods\nlike .json or .text on the response are async\n\"\"\"\n\nasync def callback(request, response):\n print(response.status)\n print(await response.text())\n\n\"\"\"\nCreate an APIRequest object. Each object corresponds to a single request, and can take in an optional callback\nEverything except request_method and request_url is optional\n\"\"\"\nreq = APIRequest(\n request_method=\"GET\",\n request_url=\"https://www.google.com\",\n request_headers={\"User-Agent\": \"Mozilla/5.0\"},\n request_params={\"q\": \"python\"},\n request_json={\"key\": \"value\"},\n request_form_data={\"key\": \"value\"},\n callback=callback,\n)\n\np = Parallelizer(\n logging_level=logging.INFO, # default: logging.ERROR\n max_requests_per_second=10, # default: 1\n max_retry_attempts=1, # default: 3\n seconds_to_sleep_after_rate_limit_error=10, # default: 15\n)\n\n# make 100 requests\nasyncio.run(p.make_requests([req] * 100))\n```",
"bugtrack_url": null,
"license": "MIT",
"summary": "A utility to concurrently make HTTP requests, with an optional rate limit. Powered by asyncio and aiohttp",
"version": "0.1.4",
"project_urls": {
"Documentation": "https://github.com/SphericalKat/eidolon/blob/main/README.md",
"Homepage": "https://github.com/SphericalKat/eidolon",
"Repository": "https://github.com/SphericalKat/eidolon"
},
"split_keywords": [
"asyncio",
"aiohttp",
"http",
"requests",
"concurrency",
"rate-limit"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fd01aa477d0e506eda28e2376fa39ee27ecc4c06750e4d28cfebe556d03a7ca3",
"md5": "09bbf63e411df65e31a1ddb00aa04ffa",
"sha256": "5f007bec7cb9549a9b43061d2e08596e6ca020e29592cd1ac762e8a5a13e5c1f"
},
"downloads": -1,
"filename": "eidolon-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "09bbf63e411df65e31a1ddb00aa04ffa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5586,
"upload_time": "2023-06-13T06:58:12",
"upload_time_iso_8601": "2023-06-13T06:58:12.982499Z",
"url": "https://files.pythonhosted.org/packages/fd/01/aa477d0e506eda28e2376fa39ee27ecc4c06750e4d28cfebe556d03a7ca3/eidolon-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d84123ccaaac864a9b7d48553eb10fa13a8d2b87bcdd081130c384ef7473caa0",
"md5": "c6228768e41f47b711fbc0993fd2f850",
"sha256": "caa6603ecab27af142fa0f441a616dca69d7e128b77c82a8c0d2bd586f0bc844"
},
"downloads": -1,
"filename": "eidolon-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "c6228768e41f47b711fbc0993fd2f850",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4574,
"upload_time": "2023-06-13T06:58:14",
"upload_time_iso_8601": "2023-06-13T06:58:14.384307Z",
"url": "https://files.pythonhosted.org/packages/d8/41/23ccaaac864a9b7d48553eb10fa13a8d2b87bcdd081130c384ef7473caa0/eidolon-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-13 06:58:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SphericalKat",
"github_project": "eidolon",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "eidolon"
}