aiohttp icon indicating copy to clipboard operation
aiohttp copied to clipboard

Aiohttp implementation for MicroPython

Open AmirHmZz opened this issue 4 years ago • 6 comments

Is your feature request related to a problem?

There's lack of a suitable async http client and server for MicroPython.

Describe the solution you'd like

Aiohttp can be implemented for MicroPython language to be used in many IOT projects.

Describe alternatives you've considered

There are some tiny - non developed projects but they are full of bugs.

Related component

Server, Client

Additional context

MicroPython supports asyncio and I think some memory optimization stuff should be done.

Code of Conduct

  • [X] I agree to follow the aio-libs Code of Conduct

AmirHmZz avatar Feb 01 '22 08:02 AmirHmZz

I'm sure nobody here is going to have the time and motivation to look at this. But, if you can get it working and have the tests running in CI, then it could be considered. I'm a little concerned how many little hacks might be needed to make it work though. I can see that asyncio is not included, so you would have to add a bunch of:

try:
    import asyncio
except ImportError:
    import uasyncio as asyncio

I imagine there are more things that might make it awkward and not worth doing.

Dreamsorcerer avatar Feb 01 '22 18:02 Dreamsorcerer

What about https://github.com/micropython/micropython-lib/tree/master/micropython/uaiohttpclient?

vrcoelho avatar Nov 06 '22 22:11 vrcoelho

What about https://github.com/micropython/micropython-lib/tree/master/micropython/uaiohttpclient?

What about it? Maybe useful for some people, but with <100 lines of code, it's hardly an implementation of aiohttp or anything that can be transferred into aiohttp itself.

Dreamsorcerer avatar Nov 07 '22 19:11 Dreamsorcerer

Hi, I am writing on an IoT Project that transfers data over http. I am looking for a way to speed things up as the requests library is a blocking function that slows down my entire system (ESP32 with attached sensors were data is gathered in asyncio tasks). Is this feature request still open, or are there some other libraries that might be usefull for async data transfer via http?

ds-digid avatar Nov 21 '23 09:11 ds-digid

Nobody else has looked at it, my comment is still the same. It could be included if the changes are fairly small (see, for example, #7803). When I looked it seemed like it would probably need some rather invasive changes to work with their uasyncio thing, however, looking again today, it looks like they've added a proper implementation of asyncio, which might makes things a lot easier.

Dreamsorcerer avatar Nov 21 '23 17:11 Dreamsorcerer

After v1.21 release uasyncio has been renamed to asyncio. Support for SSLContext was added too in https://github.com/micropython/micropython/commit/e8a4c1dd537c7ccfba92936c6eee9d5cf529be9e .

AmirHmZz avatar Nov 21 '23 19:11 AmirHmZz