GithubHelp home page GithubHelp logo

aioreq's Introduction

This is an educational package (for myself) and has very limited practical use cases, if any.

aioreq

Minimal performant package to asynchronously make GET requests without any dependencies other than asyncio (from the standard library).

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 using low-level primitives, i.e. not using any third-party package such as aiohttp.

Example

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 requests only
  • HTTP requests only
  • Get the payload as bytes after the connection has been closed. This payload will also include HTTP headers.

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:

  1. experiments/synchronous_client.py - sync.
  2. experiments/multiplexing.py - async.
  3. experiments/asyncio_sockets.py - async.
  4. examples/client.py - async.

Resources

Some resources I have found extremely usefull in the process of developing this small package:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.