A simple http.server based web server
Project description
Simple Web Server
A simple web server package built using Python's http.server
module. This library provides an easy way to serve files and handle HTTP requests with custom routing.
Features
- Lightweight and easy to use.
- Modular route management through dynamic import of modules.
- Threading support for handling multiple requests concurrently.
- Custom request handlers for specific endpoints.
Installation
You can install the package via pip
:
pip install simplewebserver
Usage
from simplewebserver import SimpleWebServer
import my_routes # Your custom route module
# Create a new server instance
server = SimpleWebServer()
# Include your custom route module
server.include_routes_module(my_routes)
# Start the server on port 5000
server.start(port=5000)
# my_routes.py
from simplewebserver import route, Request, Response
@route('/hello')
def hello_world(request:Request):
return Response({'message': 'Hello, World!'})
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
simplewebserver-0.0.3.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file simplewebserver-0.0.3.tar.gz
.
File metadata
- Download URL: simplewebserver-0.0.3.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92a5d8eb14cf1a0ed81c705377b2e96dea1387e06918ca6e807e7ceae6c0bb33 |
|
MD5 | d9ac1e088be3713df549510e6fe43087 |
|
BLAKE2b-256 | 22884e3caa197e7ea2cd7a512f98a2dfa50f969e1e484e9d55d041dd7b8cbb5a |
File details
Details for the file simplewebserver-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: simplewebserver-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf90db384753ea39b27abf2964223f46842139e597791ed6ae3e3afd30d063b9 |
|
MD5 | 326eb5dcfa6f7727795c72c581fb354a |
|
BLAKE2b-256 | 95fa692cfa78bb63c777b1fbd01ec64e4f0cf937114c3b83b5ea01e4617faae7 |