kopia lustrzana https://github.com/micropython/micropython-lib
![]() According to RFC https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 header names are case-insensitive. This commit makes sure that the module behaves consistently regardless of the casing of "Content-type" and "Content-Length" (other headers are not considered by the module). Without this fix, the client seems to wait for the connection termination (~10 seconds) prior to returning any content if the casing of "Content-Length" is different. Signed-off-by: FuNK3Y <fun__key@hotmail.com> |
||
---|---|---|
.. | ||
aiohttp | ||
examples | ||
README.md | ||
manifest.py |
README.md
aiohttp is an HTTP client module for MicroPython asyncio module, with API mostly compatible with CPython aiohttp module.
[!NOTE] Only client is implemented.
See examples/client.py
import aiohttp
import asyncio
async def main():
async with aiohttp.ClientSession() as session:
async with session.get('http://micropython.org') as response:
print("Status:", response.status)
print("Content-Type:", response.headers['Content-Type'])
html = await response.text()
print("Body:", html[:15], "...")
asyncio.run(main())
$ micropython examples/client.py
Status: 200
Content-Type: text/html; charset=utf-8
Body: <!DOCTYPE html> ...