Skip to main content

A minimalistic non-threaded HTTP server written in Python. Supports REST & WebSockets¹.

Project description

drawing

A simple, minimal and flexible HTTP server.
Supports modules for parsing WebSocket¹ traffic as well as REST api routes.

Supports

  • REST routes (@http.route('/some/endpoint'))
  • websockets if @http.on_upgrade is defined using spiderWeb ¹
  • Static file emulation with @http.route('/example.html')
  • vhosts
  • ssl/tls
  • No threading or threads used (fully relies on epoll() (select() on Windows))
  • flexible configuration for webroots etc via @http.configuration

Minimal example

import slimhttpd

http = slimhttpd.host(slimhttpd.HTTP)

while 1:
	for event, *event_data in http.poll():
		pass

The only important thing is that .poll() has to be called in order to process the events.

Footnote

It's not pretty down here. But it'll do in a pinch.

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

slimHTTP-1.0.1rc3.tar.gz (14.7 kB view hashes)

Uploaded Source

Built Distribution

slimHTTP-1.0.1rc3-py3-none-any.whl (27.8 kB view hashes)

Uploaded Python 3

Supported by

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