This is an educational package (for myself) and has very limited practical use cases, if any.
Minimal performant package to asynchronously make GET requests without any dependencies other than
My goal for this project was to:
- Learn about asynchronous code in a practical manner.
- Build a small package that allows you to send multiple requests asynchronously.
Check out examples/client.py on how to use this package. It is as simple as:
import asyncio import aioreq async def main(): urls = [("example.org", 80), ...] return await aioreq.get_requests(urls) asyncio.run(main())
Practical use cases of this package
What you can do:
- Handle requests asynchronously without any third-party library.
- Get the payload as bytes after the connection has been closed. This payload will also include
Basically all advanced things, you can not do using this package. Even basic things like
POST requests are not implemented.
Understanding what is going on
From basic principles (synchronous requests) to a package to handle requests asynchronously without any third-party library:
- experiments/synchronous_client.py – sync.
- experiments/multiplexing.py – async.
- experiments/asyncio_sockets.py – async.
- examples/client.py – async.
Some resources I have found extremely usefull in the process of developing this small package:
- Build your own async by David Beazly
- implementation in Python – showing that there can only be one eventloop per thread.
- Non-blocking sockets write-up.