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.6.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file simplewebserver-0.0.6.tar.gz
.
File metadata
- Download URL: simplewebserver-0.0.6.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77368d02f9dde814f6671450b897aad81e63267e603921eb86439ba5d7ad3723 |
|
MD5 | b1bd424716c8e177c19a7d2d4d5f7395 |
|
BLAKE2b-256 | 60878b4ad8030236bedaee578cc18916157c63b502fae4655358a59800c60ee3 |
File details
Details for the file simplewebserver-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: simplewebserver-0.0.6-py3-none-any.whl
- Upload date:
- Size: 6.1 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 | 47881fa45acd2cde6022db70b6b2dce688b4f66602f4f2526253f4bffc5a63ee |
|
MD5 | 6da02501a253c43a33002227f6105286 |
|
BLAKE2b-256 | 61da532ca07b187a013ae431c690751bdc1d4e31c3e080505c1a6da4421183e9 |