SimpleHTTP404Server: Easy testing of 404.html
SimpleHTTP404Server allows easy testing of static HTML providers that allow 404 response customization via a 404.html page. This includes at least GitHub and FastMail. It is a simple extension to SimpleHTTPServer, a built-in Python module which servers the current directory over HTTP.
If you server a static site using GitHub Pages or another static website provider, this module can help you test your 404 page before pushing changes to a live website.
First install the package using pip:
pip install SimpleHTTP404Server
Browse to the directory, and run the following to server it on port 8000.
python -m SimpleHTTP404Server
Or, if you’d like to specify a different port:
python -m SimpleHTTP404Server 1234
And that’s it! Now browse to a page that exists, maybe http://localhost:8000/index.html. And check that your 404.html page is properly loaded by checking a few different paths: * http://localhost:8000/404.html * http://localhost:8000/does-not-exist.html * http://localhost:8000/does/not/exist.html
Usecases
Personally this is used to test any GitHub Pages sites I use, in particular my blog, which is build on Pelican. This is done via Fabric:
@task
def serve():
"""Locally serve the blog."""
local('cd {deploy_path} && python -m SimpleHTTP404Server {listen_port}'.format(**env))
Future
Please let me know (by filing issues or pull requests) if you find any bugs or if you feel there are features missing.
v0.2.0: May 13, 2015
Switch back to a simple way of getting the 404.html page. The complicated way seems to imply it fixed server 404 pages from non-root directories…but it doesn’t, ensure your paths are absolute.
v0.1.2: May 13, 2015
Package readme, changelog.
v0.1.1: May 13, 2015
Supports packaged version uploaded to pypi.
v0.1.0: Feb. 24, 2015
Initial version, supports loading 404.html page from any subdirectory.
Metadata
Release files for SimpleHTTP404Server 0.2.0
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 |
|---|---|---|---|---|
| SimpleHTTP404Server-0.2.0.tar.gz | 3.8 kB | Without provenance | Details for SimpleHTTP404Server-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| SimpleHTTP404Server-0.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for SimpleHTTP404Server-0.2.0-py2.py3-none-any.whl |
Total release size: 9.0 kB
Release files / SimpleHTTP404Server-0.2.0.tar.gz
| Download URL | SimpleHTTP404Server-0.2.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bda0a2b28d327d49ee7566613c30a1946e4cdf73a39799258e9e22e53cd5567c
|
|
BLAKE2b-256 checksum How to use checksums |
40c93ff03c9112da485642e9da9717ba5d0be57bd4e7372b09f12482ec5eb92b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / SimpleHTTP404Server-0.2.0-py2.py3-none-any.whl
| Download URL | SimpleHTTP404Server-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7c95346bb136e82caa3267606c94125cdd8a4dfb60e6aed0f1aaf8c9138b9304
|
|
BLAKE2b-256 checksum How to use checksums |
d4d6a6fce73358fb96019d07953cb339fc4f0cac028b50aef2cb8bf9bbdfc274
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for SimpleHTTP404Server 0.2.0
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.