Checks static html files for bad links
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test_data
.gitignore
LICENSE
README.md
__init__.py
existence.py
setup.py
tests.py

README.md

existence

Recursively scans directories for static html files for bad or empty links. See here why I wrote this, I hate missing details!

Example bad or empty links

<a href=""></a>            Empty
<a href></a>               Empty
<a href="python.org"></a>  Any bad link will fail, this one is missing http://

Command line

$ existence /path/to/working/links
Checking links...
57 of 57
All of your links exist!

$ existence /path/to/bad/links
Checking links...
23 of 23
Broken links:
    /path/to/bad/links/index.html@121 'None'
    /path/to/bad/links/other.html@22 'non-existant.html'

Python

>>> from existence import scan
>>> scan("/path/to/working/links")
[]
>>> scan("/path/to/bad/links")
[
    ('None', '/path/to/bad/links/index.html', 121),
    ('non-existant.html', '/path/to/bad/links/other.html', 22)
]
# Returns a list of bad url tuples: [(url, file_name, line_number)]

Progress bar

To enable the progress bar pip install progressbar==2.3

Running tests

> python -m unittest discover