Closed RafaelWO closed 8 months ago
This PR adds the feature of defining custom response functions to process the response, i.e. callbacks. This means that the user can decide what to do with the response.
A simple example might be getting the HTTP status codes for a bunch of URLs:
import asyncio from unparallel import up async def main(): urls = [ "https://www.example.com", "https://duckduckgo.com/", "https://github.com" ] return await up(urls, method="HEAD", response_fn=lambda x: x.status_code) results = asyncio.run(main()) print(results)
This prints:
Making async requests: 100%|███████████| 3/3 [00:00<00:00, 4.43it/s] [200, 200, 200]
Main Changes:
Additional Changes:
Closes #100
CODE_OF_CONDUCT.md
CONTRIBUTING.md
make codestyle
Description
This PR adds the feature of defining custom response functions to process the response, i.e. callbacks. This means that the user can decide what to do with the response.
A simple example might be getting the HTTP status codes for a bunch of URLs:
This prints:
Main Changes:
Additional Changes:
Related Issue
Closes #100
Type of Change
Checklist
CODE_OF_CONDUCT.md
document.CONTRIBUTING.md
guide.make codestyle
.