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.4.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file simplewebserver-0.0.4.tar.gz
.
File metadata
- Download URL: simplewebserver-0.0.4.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 | 97e295f6b4e4ce5d97d35a43d2f1a9533da7cd8ca78696a324f18b165dcf1b71 |
|
MD5 | 8de503fb507f9295f9560f24ed6ffbd0 |
|
BLAKE2b-256 | 69235d96e00c400d8b789e15ba807bb2f886bdabdd2963291639759518e2a8a5 |
File details
Details for the file simplewebserver-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: simplewebserver-0.0.4-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 | fff94f3bc3506e0fc8869d887024c25b13cc4528fe17009b8c9c9b0149bd85d5 |
|
MD5 | e8bc2a16239027a197bd7c25810b1d18 |
|
BLAKE2b-256 | 9daf8acc2e44902a33c5dbb89e9d7ee2a15fff1943d4b3814bd48f433f7b141b |