Sure! Here's an updated README.md file based on the new code base:
PyAutoReloadHTTPServer
PyAutoReloadHTTPServer is a simple Python package that provides an HTTP server with automatic reloading functionality. It allows you to serve static files and dynamically reload them whenever they are modified, created, or destroyed. You no longer have to restart your local server to load changed files, this will serve files as they're added and changed. Give it a shot!
Installation
You can install PyAutoReloadServer using pip:
pip install pyautoreloadserver
Usage
The easiest way to run it, is to use it from the command line
pyautoreloadserver -n localhost -p 5555 -r .
The flags above can be summarized as follows
n: the hostnamep: the portr: the root directory to monitor
To use PyAutoReloadHTTPServer, create an instance of the AutoReloadHTTPServer class and call the serve method to start the server. By default, the server listens on localhost and port 8000, and serves files from the current directory.
from pyautoreloadserver import AutoReloadHTTPServer
# Create an instance of AutoReloadHTTPServer
server = AutoReloadHTTPServer()
# Start the server
server.serve()
You can customize the server behavior by providing optional arguments to the AutoReloadHTTPServer initializer:
host(str): The hostname or IP address to bind the server to (default: "localhost").port(int): The port number to listen on (default: 8000).root(str): The root directory to serve files from (default: ".").delay(float): The delay between serving requests (default: 0.001 seconds).ServerClass(TCPServer): The server class to use (default: HTTPServer).RequestHandlerClass(BaseHTTPRequestHandler): The request handler class to use (default: SimpleHTTPRequestHandler).
from pyautoreloadserver import AutoReloadHTTPServer
# Create an instance of AutoReloadHTTPServer with custom options
server = AutoReloadHTTPServer(host="0.0.0.0", port=8080, root="/path/to/files")
# Start the server
server.serve()
Once the server is running, you can visit the specified host and port in your web browser to access the served files.
To stop the server, call the stop method:
server.stop()
Although you'll probably want to start this in a separate thread/process because the server is running a loop that may block.
Logging
PyAutoReloadHTTPServer logs informational messages using the logging module. By default, the log level is set to logging.INFO, but you can configure it according to your needs.
import logging
# Set the log level to DEBUG for more detailed logs
logging.basicConfig(level=logging.DEBUG)
Contributing
Contributions to PyAutoReloadHTTPServer are welcome! If you find a bug, have a feature request, or want to contribute code, please open an issue or submit a pull request on the GitHub repository.
License
This project is licensed under the MIT License.
Metadata
Release files for pyautoreloadserver 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyautoreloadserver-0.0.2.tar.gz | 5.7 kB | Without provenance | Details for pyautoreloadserver-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyautoreloadserver-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for pyautoreloadserver-0.0.2-py3-none-any.whl |
Total release size: 13.1 kB
Release files / pyautoreloadserver-0.0.2.tar.gz
| Download URL | pyautoreloadserver-0.0.2.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2280902148e7c3c79580a65e2d10dd1c9b398c3f7c3a4aea36fe5b5db7c1490e
|
|
BLAKE2b-256 checksum How to use checksums |
75bd4bc24f842980a8f9a740711449061e02ca6a5172caf6d096d1862773d401
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / pyautoreloadserver-0.0.2-py3-none-any.whl
| Download URL | pyautoreloadserver-0.0.2-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a72652c22a5617c03da83c1cc40e879c12e37c1d0c1d9d69f2445e51ee7b894
|
|
BLAKE2b-256 checksum How to use checksums |
34e05b6b77460a71c15cfd5ad4c77d4ee6054a0e6afb336cd626cfa0524cd3de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for pyautoreloadserver 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.