← index #18385PR #778
Likely Duplicate · medium · value 3.457
QUERY · ISSUE

aiohttp newer version

openby LaySoftopened 2025-11-08updated 2025-11-10
enhancementproposed-close

This is how I install the aiohttp library on ESP32 C3 super mini:

import mip
mip.install('aiohttp')

Unfortunately, this installs a very old version: 0.0.6.
Is there any way to get a newer version?

CANDIDATE · PULL REQUEST

micropython/aiohttp: Add aiohttp package.

mergedby Carglglzopened 2023-12-10updated 2023-12-21

Implement an updated version of uaiohttpclient (renamed aiohttp) with ClientSession, WebSocketClient and SSLContext support, which is mostly compatible with CPython aiohttp-v3.9.1. client i.e. https://docs.aiohttp.org/en/stable/client_quickstart.html

This replaces #752 and #724 and requires:

  • https://github.com/micropython/micropython/pull/11897
4 comments
dpgeorge · 2023-12-18

This is a really great contribution, thank you!

A few top-level comments/questions:

  • Did you write this from scratch, or copy pieces from other locations (maybe uaiohttpclient)? The main question here is about licensing/copyright.
  • For the things that are implemented do they match CPython's aiohttp exactly? If not, can you document any differences?
  • This library should be placed in the python-ecosys directory, because it's aiming to match something that already exists (in the Python ecosystem). And the manifest.py should have the option pypi="aiohttp" added to the metadata() entry there (see other packages in the python-ecosys dir for hints).
  • I suggest to keep the old uaiohttpclient library as-is, and it can be deprecated and removed in the future. Essentially aiohttp will be a completely new package.
Carglglz · 2023-12-19

Thanks for the feedback!

Did you write this from scratch, or copy pieces from other locations (maybe uaiohttpclient)? The main question here is about licensing/copyright.

The original idea was to add this to uaiohttpclient , but I felt that it was a bit outdated so I though it would be better to add this as a replacement. ( although I agree with keeping uaiohttpclient as-is). So the source code I used comes from:

  • uaiohttpclient (MIT) -> ClientResponse , ChunkedClientResponse, _request, request_raw
  • aiohttp (Apache-2) -> https://docs.aiohttp.org/en/stable/client_reference.html
    And for WebSockets I used this too:
  • (MIT) https://github.com/danni/uwebsockets
  • (MIT) https://github.com/miguelgrinberg/microdot/blob/main/src/microdot_asyncio_websocket.py

For the things that are implemented do they match CPython's aiohttp exactly? If not, can you document any differences?

I would say so, e.g. all examples run as expected in MicroPython and CPython.

The TLDR of the things that are implemented is:
most features of https://docs.aiohttp.org/en/stable/client_quickstart.html (except Timeouts, and file uploads)
and some of https://docs.aiohttp.org/en/stable/client_advanced.html (i.e. headers and SSLContext)

I think the main difference is that MicroPython implementation is missing some keyword arguments in ClientSession and in requests method (I may update this with the "exact" diff if necessary)

Also if you see anything that can be improved let me know or feel free to add any changes and I can review them later (whatever is faster 👍🏼 )

dpgeorge · 2023-12-20

So the source code I used comes from:
...

Great, thanks for those details. That all looks fine, the code is all MIT.

The TLDR of the things that are implemented is: most features of https://docs.aiohttp.org/en/stable/client_quickstart.html (except Timeouts, and file uploads) and some of https://docs.aiohttp.org/en/stable/client_advanced.html (i.e. headers and SSLContext)

That's really good, getting the quick-start code mostly working is great.

I think the main difference is that MicroPython implementation is missing some keyword arguments in ClientSession and in requests method (I may update this with the "exact" diff if necessary)

That's fine. These things can be added in the future if needed.

dpgeorge · 2023-12-20

Thanks for updating. Now merged.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied