Checks static .html files for bad links
Project description
existence
=========
Recursively scans directories for static html files for bad or empty links. See
[here](http://www.ericcarmichael.com/writing-my-first-python-package.html) why I wrote this, I hate missing details!
# Example bad or empty links
```html
<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/dir
Checking links...
57 of 57
All of your links exist!
> existence /path/to/bad/links
Broken link found in file /path/to/bad/links/index.html on line 121 linking to None
Broken link found in file /path/to/bad/links/other.html on line 22 linking to non-existant.html
## Python
```python
>>> from existence import scan
>>> scan("/path/to/dir")
[]
>>> 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
=========
Recursively scans directories for static html files for bad or empty links. See
[here](http://www.ericcarmichael.com/writing-my-first-python-package.html) why I wrote this, I hate missing details!
# Example bad or empty links
```html
<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/dir
Checking links...
57 of 57
All of your links exist!
> existence /path/to/bad/links
Broken link found in file /path/to/bad/links/index.html on line 121 linking to None
Broken link found in file /path/to/bad/links/other.html on line 22 linking to non-existant.html
## Python
```python
>>> from existence import scan
>>> scan("/path/to/dir")
[]
>>> 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
existence-0.2.4.zip
(5.7 kB
view details)
File details
Details for the file existence-0.2.4.zip
.
File metadata
- Download URL: existence-0.2.4.zip
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c82dabd1239fefe6595d7d1066d9f20d4db31a13af8480412f147f67e2fe5f0f |
|
MD5 | 224f4d057d344e043fa322eb62b8eb71 |
|
BLAKE2b-256 | 274f744eb85bf6ea54075be9b193a193c1e5df4101bd9473a4fc3b27c3215a7e |