Skip to main content

micro_http_server

a simple http server for micropython and CPython which also happens to be fast

examples

def my_post_handler(url, data) -> tuple:
    code, hdrs = 404, {}
    if url == "/users":
        for k, v in data.items():
            DB[k] = v
        code = 200
    return code, "", hdrs

def my_get_handler(url, data) -> tuple:
    return 200, "hello world!", {}

async def my_handle_client(reader, writer):
    handlers = {
        "get": my_get_handler,
        "post": my_post_handler,
    }
    await userver.handle_client(reader, writer, handlers)
    await userver.finalise_client(reader, writer)
    
async def main():
    loop.create_task(asyncio.start_server(my_handle_client, "0.0.0.0", 3000))

speed

Not a design consideration, but. Benchmarking a simple GET request handler, one request takes ~200 usec user time. Running on a Macbook M1, a single core can serve approx 6000 requests/sec.

Metadata

Release files for micro_http_server 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for micro_http_server 0.1.2
File Size Uploaded Provenance Actions
micro_http_server-0.1.2.tar.gz 7.6 kB Without provenance Details for micro_http_server-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for micro_http_server 0.1.2
File Interpreter ABI Platform Actions
micro_http_server-0.1.2-py3-none-any.whl Python 3 none any Details for micro_http_server-0.1.2-py3-none-any.whl

Total release size: 13.3 kB

Release files / micro_http_server-0.1.2.tar.gz

Download URL micro_http_server-0.1.2.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fe3419b89734012fa46779b628d33084443d8d20cd6a01e19fd7e1959c07f932
BLAKE2b-256 checksum
How to use checksums
00fdf596b98e5d1cf210403f2c78e86b4dfd10bf01cfbf9d829a1afcae22fef2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.1

Release files / micro_http_server-0.1.2-py3-none-any.whl

Download URL micro_http_server-0.1.2-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67c73818949a6b46ffafa74f9c8c61e2e611f99c0b10d33ad4fa4ec13baf634c
BLAKE2b-256 checksum
How to use checksums
6912b87a73f6002050a602fbc1437d7a94b4b16b1f1134f407ee229df437461e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.1

Security for micro_http_server 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page