Skip to main content

A super simple Python utility to check for dead links in a website

Project description

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.
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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylich-0.3.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

pylich-0.3.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

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

Hashes for pylich-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8a8acbc4a5788d128bb797a2a38f4498e45770c50f3c47e130de63dbea2aed47
MD5 b87a23f4e03bc5c319c69c3b841dde9f
BLAKE2b-256 fa5fe6cefa87075e4b7bdaab313e3dc1718924d113fda18692980d9214fdfcc9

See more details on using hashes here.

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

Hashes for pylich-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ab4e8c06ae1120b3489ad9b968cf8e908e54a8f8a76a5d63f876c7709918ce0
MD5 ef00078773bc3d848deaa7ed1c2b7426
BLAKE2b-256 3b589c603cf727d5a127814eab87e47983633f3830a5ac5cd2683f99d9550358

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page