Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aiohttp implementation for MicroPython #6584

Open
1 task done
AmirHmZz opened this issue Feb 1, 2022 · 6 comments
Open
1 task done

Aiohttp implementation for MicroPython #6584

AmirHmZz opened this issue Feb 1, 2022 · 6 comments

Comments

@AmirHmZz
Copy link

AmirHmZz commented Feb 1, 2022

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

  • I agree to follow the aio-libs Code of Conduct
@Dreamsorcerer
Copy link
Member

Dreamsorcerer commented Feb 1, 2022

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
Copy link
Member

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.

@ds-digid
Copy link

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?

@Dreamsorcerer
Copy link
Member

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.

@AmirHmZz
Copy link
Author

AmirHmZz commented Nov 21, 2023

After v1.21 release uasyncio has been renamed to asyncio. Support for SSLContext was added too in micropython/micropython@e8a4c1d .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants