{"id":13802092,"url":"https://github.com/wybiral/micropython-aioweb","last_synced_at":"2026-01-23T14:32:09.874Z","repository":{"id":75328718,"uuid":"319103463","full_name":"wybiral/micropython-aioweb","owner":"wybiral","description":"A minimalist asyncio web framework for MicroPython.","archived":false,"fork":false,"pushed_at":"2023-01-13T15:48:12.000Z","size":17,"stargazers_count":26,"open_issues_count":4,"forks_count":14,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-04-22T12:33:32.907Z","etag":null,"topics":["asyncio","esp32","http","micropython","server-sent-events","sse","uascynio","websocket"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wybiral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-12-06T18:32:56.000Z","updated_at":"2024-02-06T10:51:25.000Z","dependencies_parsed_at":"2023-06-06T04:15:09.387Z","dependency_job_id":null,"html_url":"https://github.com/wybiral/micropython-aioweb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wybiral%2Fmicropython-aioweb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wybiral%2Fmicropython-aioweb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wybiral%2Fmicropython-aioweb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wybiral%2Fmicropython-aioweb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wybiral","download_url":"https://codeload.github.com/wybiral/micropython-aioweb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253942611,"owners_count":21988098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","esp32","http","micropython","server-sent-events","sse","uascynio","websocket"],"created_at":"2024-08-04T00:01:35.671Z","updated_at":"2026-01-23T14:32:09.827Z","avatar_url":"https://github.com/wybiral.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Communications"],"readme":"# micropython-aioweb\nA very minimal asyncio web framework for MicroPython. Doesn't come with all the bells and whistles you might want out of a serious web framework but the goal is just to make asyncio HTTP applications in MicroPython as simple and efficient as possible.\n\n## Current features\n* minimal overhead in terms of code size or memory use\n* easy integration into existing asyncio projects by running as a normal task alongside others\n* basic endpoint/method based routing similar to flask (currently doesn't do any pattern matching)\n* parses http request line, headers, and query strings\n* supports WebSockets!\n* supports Server-Sent Events!\n\n## Examples\n### Basic \"Hello world!\"\n```python\nimport web\nimport uasyncio as asyncio\n\napp = web.App(host='0.0.0.0', port=80)\n\n# root route handler\n@app.route('/')\nasync def handler(r, w):\n    # write http headers\n    w.write(b'HTTP/1.0 200 OK\\r\\n')\n    w.write(b'Content-Type: text/html; charset=utf-8\\r\\n')\n    w.write(b'\\r\\n')\n    # write page body\n    w.write(b'Hello world!')\n    # drain stream buffer\n    await w.drain()\n\n# Start event loop and create server task\nloop = asyncio.get_event_loop()\nloop.create_task(app.serve())\nloop.run_forever()\n```\n### POST request handler\n```python\n@app.route('/', methods=['POST'])\nasync def handler(r, w):\n    body = await r.read(1024)\n    form = web.parse_qs(body.decode())\n    name = form.get('name', 'world')\n    # write http headers\n    w.write(b'HTTP/1.0 200 OK\\r\\n')\n    w.write(b'Content-Type: text/html; charset=utf-8\\r\\n')\n    w.write(b'\\r\\n')\n    # write page body\n    w.write(b'Hello {}!'.format(name))\n    # drain stream buffer\n    await w.drain()\n```\n### WebSocket handler\n```python\n# /ws WebSocket route handler\n@app.route('/ws')\nasync def ws_handler(r, w):\n    # upgrade connection to WebSocket\n    ws = await WebSocket.upgrade(r, w)\n    while True:\n        evt = await ws.recv()\n        if evt is None or evt['type'] == 'close':\n            # handle closed stream/close event\n            break\n        elif evt['type'] == 'text':\n            # print received messages and echo them\n            print('Received:', evt['data'])\n            await ws.send(evt['data'])\n```\n### SSE (Server-Sent Events) handler\n```python\n# /events EventSource route handler\n@app.route('/events')\nasync def ws_handler(r, w):\n    # upgrade connection to text/event-stream\n    sse = await web.EventSource.upgrade(r, w)\n    count = 0\n    while True:\n        count += 1\n        try:\n            await sse.send('Hello world #{}'.format(count))\n        except:\n            break\n        await asyncio.sleep(1)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwybiral%2Fmicropython-aioweb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwybiral%2Fmicropython-aioweb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwybiral%2Fmicropython-aioweb/lists"}