Skip to main content

Small, asynchronous web server for use with Raspberry Pi Pico W boards and similar

Project description

pWebServer

Small, asynchronous web server for use with Raspberry Pi Pico W boards and similar

Background

I wanted something small and reusable to work with my raspberry pi pico w and didn't find anything in the wild. This is a work in progress, but I intend for it to be stable for at least my own use.

Notes

This library is not designed to be particularly fast, however it is intended to be easy to use.

HTTP Methods

Self-defined methods are not currently supported. PATCH, CONNECT, and TRACE are also not implmented

Paths

Simple paths are supported. Complex path matching is not supported.

For example, in some frameworks you might be able to define a path as

/some/path/to/:id

And that would populate the id property or some other variable with the value, for pWebServer that is not the case.

For dynamic data use query strings

Example (micropython - if installed with mip):

from pWebServer.pWebServer import Server
import uasyncio as asyncio

sv = Server()
sv.add_default_route() # simply adds a route at / that returns 200 OK
loop = asyncio.get_event_loop()
loop.create_task(sv.start()) # Start serving for 0.0.0.0 (all ipv4 ips) on port 80
loop.run_forever()

Requirements

python >=3.11 or micropython >=1.20

installing

python (with pypi)

pip install pWebServer

micropython (with mip & url)

Using repl:

import mip
mip.install("github:sjsadowski/pWebServer", version="latest")

Using mpremote:

mpremote mip install github:sjsadowski/pWebServer

Dependencies

MicroPython

MicroPython does not ship with the full set of Python Standard Libraries. For information about this, check the micropython-lib GitHub repo .

  • logging

Python

** None **

Development

- pytest >= 7.4.0
- pytest-asyncio >= 0.21.0
- httpx >= 0.24.1

To Do:

  • Cookie support
  • POST/PUT data support
  • HTTP/2.0(?)
  • Better test coverage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pwebserver-25.8a5.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pwebserver-25.8a5-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file pwebserver-25.8a5.tar.gz.

File metadata

  • Download URL: pwebserver-25.8a5.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.4 CPython/3.13.5 Darwin/24.6.0

File hashes

Hashes for pwebserver-25.8a5.tar.gz
Algorithm Hash digest
SHA256 aac0ddd89bc54e5a91cc2f993688ff03e74566387cd6bfdd11779f03b46bee7a
MD5 1f4093a166246486044aeabde4b994a8
BLAKE2b-256 81e9e8fb0b8de22d8911f22fdcdd5c7692c2338ba6db0c0f8579ff550e1942d6

See more details on using hashes here.

File details

Details for the file pwebserver-25.8a5-py3-none-any.whl.

File metadata

  • Download URL: pwebserver-25.8a5-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.4 CPython/3.13.5 Darwin/24.6.0

File hashes

Hashes for pwebserver-25.8a5-py3-none-any.whl
Algorithm Hash digest
SHA256 464d63b6aa6953bc7b29d60306c46a6ace14f1d28e19d31f660eb0df93e4b50e
MD5 71e6724fcdd90f60d2bd121d301c79c8
BLAKE2b-256 dc4c07b970900111032378385cb0a0f6d6e9adf036c75eae2e7a0d04f3f7591c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page