This release is a pre-release and may not be stable for production use.
pyhtmlproofer
Check for website and static HTML pages for link rot.
Features
pyhtmlproofer can be used on
- Static HTML pages (typically generated by an SSG). You can specify either files or directories to be checked.
- Webpages, you can specify a URL/link to be checked.
pyhtmlproofer at the moment does the following:
- Checks for broken internal links in HTML files
- Checks if external links in HTML or website link are valid
- Check for scripts / stylesheets in HTML files
- Check for images in HTML files
You can read more details below in What's Tested? section.
Roadmap
The follower features are under development:
- Check for images and alt-text in HTML files
- Check Favicons
- Check optimal SEO meta tags
- Caching results
- Config file
Installation
Install pyhtmlproofer with pip:
pip install pyhtmlproofer
What's tested?
You can configure pyhtmlproofer to check:
- a file
- a directory or list of directories
- a URL / Link
Links / Hyperlinks
a, link elements: pyhtmlproofer checks-
- If the internal links are valid
- If the internal references (
#in-page-links) are valid - If the external links are valid
Images
img elements: pyhtmlproofer checks -
- if the internal image references are valid
- if the external image references are valid
Scripts
script elements: pyhtmlproofer checks -
- If the internal script references are valid
- If the external script references are reachable
Usage
a) To check a file:
import pyhtmlproofer as proofer
file = "path/to/file1.html"
proofer.file(file).check()
b) To check a directories:
import pyhtmlproofer as proofer
directory_paths = ["path/to/1/file.html", "path/to/2/file.html"]
proofer.directories(directory_paths).check()
c) To validate URL(s):
import pyhtmlproofer as proofer
links = ["https://example.com", "https://cloudbytes.dev"]
proofer.links(links).check()
CLI
There is also a CLI that can be used:
$ pyhtmlproofer check -F <file_name>
Available Config Options
PROOFER_DEFAULTS = {
"assume_extension": ".html",
"directory_index_file": "index.html",
"disable_external": False,
"ignore_files": [],
"ignore_urls": [],
"enforce_https": True,
"extensions": [".html"],
"log_level": "ERROR",
"report_to_file": True,
"report_filename": "proofer_report",
}
You can override the default configuration options by passing a dictionary of options.
import pyhtmlproofer as proofer
options = {"log_level": "ERROR", "disable_external": True}
directory_paths = ["path/to/1/file.html", "path/to/2/file.html"]
proofer.directories(directory_paths, , options=options).check()
Credits
The inspiration was by Ruby based HTMLProofer and lack of Python based alternatives. Although, pyhtmlproofer is not a Python rewrite, instead it focuses on solving problems that I encountered while maintaining CloudBytes/Dev> website.
Metadata
Release files for pyhtmlproofer 0.7.3a0
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 |
|---|---|---|---|---|
| pyHtmlProofer-0.7.3a0.tar.gz | 30.9 kB | Without provenance | Details for pyHtmlProofer-0.7.3a0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyHtmlProofer-0.7.3a0-py3-none-any.whl | Python 3 | none | any | Details for pyHtmlProofer-0.7.3a0-py3-none-any.whl |
Total release size: 55.6 kB
Release files / pyHtmlProofer-0.7.3a0.tar.gz
| Download URL | pyHtmlProofer-0.7.3a0.tar.gz |
|---|---|
| Size | 30.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17ac23ef4cb1dff7fb0fb8e0105164c9cbda5345694c8743990b47f92cc6f3b8
|
|
BLAKE2b-256 checksum How to use checksums |
9f97dc65d74c96535f88327d87d02a8d55567f17c59531bc96f7886fe7cc7beb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.1.3 CPython/3.8.13
|
Release files / pyHtmlProofer-0.7.3a0-py3-none-any.whl
| Download URL | pyHtmlProofer-0.7.3a0-py3-none-any.whl |
|---|---|
| Size | 24.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5fade45f8aa78930ad82ba061310290e3629262ea6d96f4a9cdf12f55f9231f0
|
|
BLAKE2b-256 checksum How to use checksums |
f86297af3c80d61e8c40b3b789c461a975805dea0bc261c57b007a8e9c09173c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.1.3 CPython/3.8.13
|
Security for pyhtmlproofer 0.7.3a0
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.