Skip to main content

PyLich

GitHub Actions Workflow Status PyPI - Version PyPI - Python Version GitHub License

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.
--failed-is-dead N/A Treat any failed HTTP request as a dead link, regardless of the HTTP status code.
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

Metadata

Release files for pylich 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylich 0.4.0
File Size Uploaded
pylich-0.4.0.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylich 0.4.0
File Interpreter ABI Platform
pylich-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / pylich-0.4.0.tar.gz

Download URL pylich-0.4.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
adafea1bba070d9a15c5209c56d9a5c43049fbfda1f46966bae670e590bb42da
BLAKE2b-256 checksum
How to use checksums
f9b22afe390a338d46f1c690c79afd61f1e75338346560ba6e54627a63e55fb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.8 Linux/6.5.0-1025-azure

Release files / pylich-0.4.0-py3-none-any.whl

Download URL pylich-0.4.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce608590b17a36802ec8e31c4862fc9ff48d88ba954257d584fa727681b390a3
BLAKE2b-256 checksum
How to use checksums
3187e279e12540639c5a01158d97efe8f9866b97625f777d3bc055bf05cf173b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.8 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page