validlink


Namevalidlink JSON
Version 0.2 PyPI version JSON
download
home_pagehttps://mrfidal.in/basic-pip-package/validlink
SummaryA simple URL validity checker
upload_time2024-06-09 16:50:25
maintainerNone
docs_urlNone
authorFidal
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ValidLink

A simple Python library to check the validity of URLs.

## Features

- Check the validity of a given URL.
- Automatically add missing schemes (e.g., `http://`).
- Handle URLs without common subdomains like `www.`.
- Graceful error handling for various request exceptions.

## Installation

```bash
pip install validlink
```

## Usage

### Basic Usage

```python
from validlink import check_url_validity

url = "https://www.example.com"
is_valid = check_url_validity(url)
if is_valid:
    print(f"The URL {url} is valid.")
else:
    print(f"The URL {url} is not valid.")
```

### Handling Different URL Formats

```python
from validlink import check_url_validity

urls = [
    "example.com",
    "http://example.com",
    "https://example.com",
    "www.example.com",
    "example.com/test",
]

for url in urls:
    is_valid = check_url_validity(url)
    if is_valid:
        print(f"The URL {url} is valid.")
    else:
        print(f"The URL {url} is not valid.")
```

### Extracting URLs from Messages

```python
from validlink import find_urls_in_message, check_url_validity

messages = [
    "your message Eid code good https://www.example.com thank you god",
    "your message Eid code good example.com thank you god",
]

for message in messages:
    urls = find_urls_in_message(message)
    for url in urls:
        is_valid = check_url_validity(url)
        if is_valid:
            print(f"The URL {url} found in the message is valid.")
        else:
            print(f"The URL {url} found in the message is not valid.")
```

### Checking URLs from User Input

```python
from validlink import check_url_validity

url = input("Enter a URL to check: ")
is_valid = check_url_validity(url)
if is_valid:
    print(f"The URL {url} is valid.")
else:
    print(f"The URL {url} is not valid.")
```

### Handling URLs in Web Scraping

```python
import requests
from validlink import check_url_validity

# Assume urls_list contains a list of URLs obtained from web scraping
urls_list = ["https://www.example.com", "http://example.com", "www.example.com"]

for url in urls_list:
    is_valid = check_url_validity(url)
    if is_valid:
        print(f"The URL {url} is valid.")
    else:
        print(f"The URL {url} is not valid.")
```

## License

This project is licensed under the MIT License. See the LICENSE file for details.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

## Acknowledgements

Special thanks to all the contributors of open-source libraries that made this project possible.

## Thank You

Thank you to all users who have found this tool helpful! Your support and feedback are greatly appreciated. ❤️🎈

            

Raw data

            {
    "_id": null,
    "home_page": "https://mrfidal.in/basic-pip-package/validlink",
    "name": "validlink",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Fidal",
    "author_email": "mrfidal@proton.me",
    "download_url": "https://files.pythonhosted.org/packages/bb/fa/54a85607cfc5f3a674701e5be93781f42ec286a3ccf2ac783846b2f853fe/validlink-0.2.tar.gz",
    "platform": null,
    "description": "# ValidLink\r\n\r\nA simple Python library to check the validity of URLs.\r\n\r\n## Features\r\n\r\n- Check the validity of a given URL.\r\n- Automatically add missing schemes (e.g., `http://`).\r\n- Handle URLs without common subdomains like `www.`.\r\n- Graceful error handling for various request exceptions.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install validlink\r\n```\r\n\r\n## Usage\r\n\r\n### Basic Usage\r\n\r\n```python\r\nfrom validlink import check_url_validity\r\n\r\nurl = \"https://www.example.com\"\r\nis_valid = check_url_validity(url)\r\nif is_valid:\r\n    print(f\"The URL {url} is valid.\")\r\nelse:\r\n    print(f\"The URL {url} is not valid.\")\r\n```\r\n\r\n### Handling Different URL Formats\r\n\r\n```python\r\nfrom validlink import check_url_validity\r\n\r\nurls = [\r\n    \"example.com\",\r\n    \"http://example.com\",\r\n    \"https://example.com\",\r\n    \"www.example.com\",\r\n    \"example.com/test\",\r\n]\r\n\r\nfor url in urls:\r\n    is_valid = check_url_validity(url)\r\n    if is_valid:\r\n        print(f\"The URL {url} is valid.\")\r\n    else:\r\n        print(f\"The URL {url} is not valid.\")\r\n```\r\n\r\n### Extracting URLs from Messages\r\n\r\n```python\r\nfrom validlink import find_urls_in_message, check_url_validity\r\n\r\nmessages = [\r\n    \"your message Eid code good https://www.example.com thank you god\",\r\n    \"your message Eid code good example.com thank you god\",\r\n]\r\n\r\nfor message in messages:\r\n    urls = find_urls_in_message(message)\r\n    for url in urls:\r\n        is_valid = check_url_validity(url)\r\n        if is_valid:\r\n            print(f\"The URL {url} found in the message is valid.\")\r\n        else:\r\n            print(f\"The URL {url} found in the message is not valid.\")\r\n```\r\n\r\n### Checking URLs from User Input\r\n\r\n```python\r\nfrom validlink import check_url_validity\r\n\r\nurl = input(\"Enter a URL to check: \")\r\nis_valid = check_url_validity(url)\r\nif is_valid:\r\n    print(f\"The URL {url} is valid.\")\r\nelse:\r\n    print(f\"The URL {url} is not valid.\")\r\n```\r\n\r\n### Handling URLs in Web Scraping\r\n\r\n```python\r\nimport requests\r\nfrom validlink import check_url_validity\r\n\r\n# Assume urls_list contains a list of URLs obtained from web scraping\r\nurls_list = [\"https://www.example.com\", \"http://example.com\", \"www.example.com\"]\r\n\r\nfor url in urls_list:\r\n    is_valid = check_url_validity(url)\r\n    if is_valid:\r\n        print(f\"The URL {url} is valid.\")\r\n    else:\r\n        print(f\"The URL {url} is not valid.\")\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License. See the LICENSE file for details.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.\r\n\r\n## Acknowledgements\r\n\r\nSpecial thanks to all the contributors of open-source libraries that made this project possible.\r\n\r\n## Thank You\r\n\r\nThank you to all users who have found this tool helpful! Your support and feedback are greatly appreciated. \u2764\ufe0f\ud83c\udf88\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple URL validity checker",
    "version": "0.2",
    "project_urls": {
        "Homepage": "https://mrfidal.in/basic-pip-package/validlink"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f9d20788bb387f0e3c5304c678f63ef60f5b4171d236273fabecfdf395205e74",
                "md5": "62dda31074e0e83504025e47b791dbbd",
                "sha256": "0f779563b7d736c9b5518632d9611838df9f046f94a27c526e00815d80224826"
            },
            "downloads": -1,
            "filename": "validlink-0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "62dda31074e0e83504025e47b791dbbd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 3673,
            "upload_time": "2024-06-09T16:50:23",
            "upload_time_iso_8601": "2024-06-09T16:50:23.545616Z",
            "url": "https://files.pythonhosted.org/packages/f9/d2/0788bb387f0e3c5304c678f63ef60f5b4171d236273fabecfdf395205e74/validlink-0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bbfa54a85607cfc5f3a674701e5be93781f42ec286a3ccf2ac783846b2f853fe",
                "md5": "2099dc2eeacb73cdf968ff7c7962cfd4",
                "sha256": "b83b668601765cc6384dbbdc699846e2c22d692e8d7286daeb2b6fd75544e61e"
            },
            "downloads": -1,
            "filename": "validlink-0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "2099dc2eeacb73cdf968ff7c7962cfd4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3510,
            "upload_time": "2024-06-09T16:50:25",
            "upload_time_iso_8601": "2024-06-09T16:50:25.224378Z",
            "url": "https://files.pythonhosted.org/packages/bb/fa/54a85607cfc5f3a674701e5be93781f42ec286a3ccf2ac783846b2f853fe/validlink-0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-09 16:50:25",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "validlink"
}
        
Elapsed time: 0.80250s