A simple implementation of a dead link detection tool using python asyncio library
Project description
;; Python-Link-Detective ;;
A simple implementation of a dead link detection tool using python httpx & asyncio library
Installation
pip install py-link-detective
Usage
py-link-detective -h
usage: py-link-detective [-h] [--version] [--num_async_requests] [--timeout] (-c | -j) url
A simple implementation of a dead link detection tool using python asyncio library
positional arguments:
url The url of the website to be checked
options:
-h, --help show this help message and exit
--version, -v show program's version number and exit
--num_async_requests , -n
number of concurrent request at a time, default is 10
--timeout , -t timeout for each request, default is 5 seconds
-c use console for output
-j use a json file(in the current path) for output
Run Tests
pytest -v
Demo
For Console Output
py-link-detective -c https://stackoverflow.com -n 20
################################# https://stackoverflow.com #################################
200 | https://stackoverflow.com/users/signup?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2f
200 | https://meta.stackoverflow.com
200 | https://stackoverflow.com
200 | https://stackoverflow.com/users/signup?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2f
200 | https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2f
200 | https://stackoverflow.com/users/login?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2f
200 | https://stackoverflow.com/questions
200 | https://stackoverflow.com/beta/discussions
200 | https://stackoverflow.com/tags
200 | https://stackoverflow.com/users/signup?ssrc=product_home
200 | https://stackoverflow.com/
200 | https://stackexchange.com/sites
200 | https://stackoverflow.com/help
200 | https://stackoverflow.com/jobs/companies?so_medium=stackoverflow&so_source=SiteNav
200 | https://stackoverflow.co/teams/
200 | https://stackoverflow.co/advertising/
200 | https://stackoverflow.blog
200 | https://stackoverflow.co/labs/
------------------------------------------------------------------
For JSON Output
py-link-detective -j https://stackoverflow.com -n 20
{
"200": [
"https://stackoverflow.com/help",
"https://stackoverflow.com/users/login?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2f",
"https://meta.stackoverflow.com",
"https://stackoverflow.com/jobs/companies?so_medium=stackoverflow&so_source=SiteNav",
"https://stackoverflow.com/tags",
"https://stackoverflow.com/users/signup?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2f",
"https://www.facebook.com/officialstackoverflow/"
],
"302": [
"https://stackoverflow.com/users",
"https://stackoverflow.co/talent/",
"https://stackoverflow.co/collectives/",
"https://stackoverflow.com/legal"
],
"400": [
"https://twitter.com/stackoverflow"
],
"301": [
"https://linkedin.com/company/stack-overflow",
"https://www.instagram.com/thestackoverflow"
],
"-1": [
"javascript:void(0)"
]
}
Contributing
Following improvements can be made to current project.
- Add structured logging
- Write more tests
- Add support for more output formats
- Add url validation
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 py_link_detective-1.0.0.tar.gz
.
File metadata
- Download URL: py_link_detective-1.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03e6a337c7ea0d3c6e8670ad3d8220425f464f020c85ce1dd2f21d588e250cf3 |
|
MD5 | eb8c7eeaecb320e7a38abe56a6422cd8 |
|
BLAKE2b-256 | c745a669f715cacc4af164bbf052d564aa0cbc5f980855bdda33587073b2a23c |
File details
Details for the file py_link_detective-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: py_link_detective-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7729f11acc2d3cbbb43f5ba941f5e44f527c5cf8f5cf4bec8f37bf36c8f7ef6f |
|
MD5 | 34b701be747b9b38e3633dd579bf4a8f |
|
BLAKE2b-256 | 88e5d999a9d3bce4ddcc6c73048b6feb1bed2a0906f61c19993d8bf155cd8657 |