Skip to main content

A Python library for crawling a website and returning a sitemap.

Project description

📖 About

Sitemappy (or sitemap-py 😉) is a crawler that produces a sitemap for a given website.

Sitemappy is a command-line application, and also provides Python interfaces for use as a library.

Features

  • Print the URL for a given website when visited
  • Print the links for a given webpage
  • Visit the links for a given webpage
  • Limit the links to follow on a webpage to the same single subdomain
  • Concurrency (asyncio, multithreading, multiprocessing)
  • Output crawling results to file by default (results too long for console)
  • Modify number of async crawler workers
  • Specify crawling depth
  • Crawling politeness argument
  • Follow HTTP redirect responses
  • HTTP error response handling
  • Add DEBUG, INFO and ERROR logging
  • Adhere to a website's robots.txt
  • "Spider Trap" resilience
  • Introduce multiprocessing
  • Distributed multiprocessing
  • Publish to PyPi 🚀
  • GitHub Workflows (deploy)
  • GitHub Workflows (linting, unit testing, dev deployments)

🚀 Usage

Generate a sitemap (./results.json):

sitemappy-cli https://monzo.com/

Help

$ sitemappy-cli --help
usage: sitemappy-cli [-h] BASE_URL

Sitemappy is a CLI tool to crawl a website and create a sitemap.
For more information about the tool go to https://github.com/dan-wilton/sitemappy/

Arguments:
  BASE_URL              a valid website URL to sitemap [required]

Options:
  --workers           INTEGER     Number of workers to asynchronously 
                                  make web requests [default: 10]
  
  --crawl-depth       INTEGER     Depth of links from base URL to follow
                                  [default: 0 - unlimited]
  
  --politeness-delay  INTEGER     Delay between each request to the website
                                  [default: 0 - none]
  
  --enable-cmd-out                Print output to cmd
  
  --help                          show this help message and exit

🎒 Requirements

Python 3.12+

Development

PDM

💻 Installation

To use the sitemappy CLI:

pip install --user -U sitemappy-cli

Local Development / Contributing

pdm install

Run the tests with:

pytest -v

Python Library

Use sitemappy in your project with one of the following:

with pip:

pip install -U sitemappy-cli

with PDM:

pdm add sitemappy-cli

with Poetry >= 1.2.0:

poetry add sitemappy-cli

macOS

NOTE: This is not yet enabled 😢

via homebrew:

brew install sitemappy-cli

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

sitemappy_cli-1.0.5.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sitemappy_cli-1.0.5-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file sitemappy_cli-1.0.5.tar.gz.

File metadata

  • Download URL: sitemappy_cli-1.0.5.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.15.4 CPython/3.10.12 Linux/6.5.0-1021-azure

File hashes

Hashes for sitemappy_cli-1.0.5.tar.gz
Algorithm Hash digest
SHA256 aa2f36edb7238c19a8028ddd6776297063308b6a39f92c570b5af06c56c81d4e
MD5 ca2e2d63382bc36a13bc68d5a11ba2be
BLAKE2b-256 1604ad9834c9259fa717453c5a28571e5ebfe8557c74d086f3c3005872d0f71d

See more details on using hashes here.

File details

Details for the file sitemappy_cli-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: sitemappy_cli-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.15.4 CPython/3.10.12 Linux/6.5.0-1021-azure

File hashes

Hashes for sitemappy_cli-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ed33b5206030adeb1357399bd5c3e9650c0a39a9424c2090f268d51557b3d28a
MD5 1fdff9a702b3e1e6461db6e852df7e68
BLAKE2b-256 f42e5b750aed44ad5239650f6f7c2319621d7fb9264a9dcbaef71cfc08822dc6

See more details on using hashes here.

Supported by

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