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.5.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file simplewebserver-0.0.5.tar.gz
.
File metadata
- Download URL: simplewebserver-0.0.5.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e69dd7a92de5020a67f45400cf1e654d738a9702e8fbd00720835ca0959a2ba |
|
MD5 | e2293a76c67f6c0a2f52a9bf1ef60828 |
|
BLAKE2b-256 | c4dc242f9aef1de3d36bead14ecab9e692e3946940fff81385b4aef94db75aa1 |
File details
Details for the file simplewebserver-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: simplewebserver-0.0.5-py3-none-any.whl
- Upload date:
- Size: 6.0 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 | 3bc363b0de6dd9415b119f0ec8f1109f1404f52a9b932646a0e661c01901825d |
|
MD5 | a22dee52e5cc6cb7c2121471564a7812 |
|
BLAKE2b-256 | dea7b75890f65b1d815e4e0a0aba37571860c1b9ac6b14411ee50ae401c4655b |