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.1.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file simplewebserver-0.0.1.tar.gz
.
File metadata
- Download URL: simplewebserver-0.0.1.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 | 7df53fec598d1eb6470cd0f381932ae34783c8e207aea5ddc5145c0141756cae |
|
MD5 | b6edde0dd8da080469a5cc142430aeb2 |
|
BLAKE2b-256 | 83e3646b7ace025f061ba8cd91a8d22361a6f271864043b6b8923a688bc1bfb9 |
File details
Details for the file simplewebserver-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: simplewebserver-0.0.1-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 | 465989a68b68591a934f102f979f8583cff52f2ecc37973fbf8c8f50c1fdcc31 |
|
MD5 | 8cc32b278afa5b91877560fa24867235 |
|
BLAKE2b-256 | c17dc46251fdb6f165040afb932b26ddd21863cb6531aea44c8e34a3915cadbc |