A super simple Python utility to check for dead links in a website
Project description
PyLich
A super simple Python utility to check for dead links in a website.
Installation
PyLich is available on PyPI and can be installed using pip:
pip install pylich
Usage
Simply provide the URL of the sitemap and pylich
will crawl through links in the pages and check their status. pylich
can be used as a command line tool or as a Python package.
Command Line
pylich https://www.example.com/sitemap.xml
The command will exit with a status code of 1 if any dead links are found and 0 otherwise.
Options
Flag | Arguments | Description |
---|---|---|
-v |
N/A | Verbose mode. Print progress to the console as well as a summary of the dead links at the end. |
-i |
List of integer HTTP response codes | Ignore links with the specified HTTP response codes. |
pylich https://www.example.com/sitemap.xml -v -i 404 500
Python Package
PyLich can also be used as a Python package.
from pylich import LinkChecker
checker = LinkChecker(
"https://www.example.com/sitemap.xml",
verbose=True,
ignored_status_codes=[404, 500]
)
urls = checker.get_sitemap_urls()
broken_links = checker.check_links(urls)
checker.print_dead_links()
Contributing
Pull requests are welcome.
Package and dependency management is done using Poetry. To install the dependencies and the package in development mode, run:
poetry install
To run the tests, run:
pytest
Pre-commit hooks are available to run code formatting and linting. To install the hooks, run:
pre-commit install
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
Built Distribution
File details
Details for the file pylich-0.3.0.tar.gz
.
File metadata
- Download URL: pylich-0.3.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.5 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a8acbc4a5788d128bb797a2a38f4498e45770c50f3c47e130de63dbea2aed47 |
|
MD5 | b87a23f4e03bc5c319c69c3b841dde9f |
|
BLAKE2b-256 | fa5fe6cefa87075e4b7bdaab313e3dc1718924d113fda18692980d9214fdfcc9 |
File details
Details for the file pylich-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: pylich-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.5 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ab4e8c06ae1120b3489ad9b968cf8e908e54a8f8a76a5d63f876c7709918ce0 |
|
MD5 | ef00078773bc3d848deaa7ed1c2b7426 |
|
BLAKE2b-256 | 3b589c603cf727d5a127814eab87e47983633f3830a5ac5cd2683f99d9550358 |