Check

Problematic

How can we efficiently check the syntax of IP, domains, and URL?

Documentation

The tool to check the availability or syntax of domains, IPv4, IPv6 or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the syntax checker interface.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/special-thanks.html
Contributors:
https://pyfunceble.github.io/contributors.html
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/master/
Project homepage:
https://pyfunceble.github.io/

License:

MIT License

Copyright (c) 2017, 2018, 2019, 2020 Nissar Chababy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
class PyFunceble.check.Check(subject)[source]

Provides our syntax checkers.

Parameters:subject (str) – The subject (URL, IP or domain) to check.
SPECIAL_USE_DOMAIN_NAMES_EXTENSIONS = ['onion']

Specifies the extension which are specified as “Special-Use Domain Names” and supported by our project.

Type:list
is_domain(subdomain_check=False)[source]

Checks if the given subject is a valid domain.

Parameters:subdomain_check (bool) –

Activates the subdomain checking.

Warning

Do not manually use.

Please report to is_subdomain().

Returns:The validity.
Return type:bool
is_ip()[source]

Checks if the given subject is a valid IPv4 or IPv6.

Returns:The validity.
Return type:bool
is_ip_range()[source]

Checks if the given subject is a valid IPv4 or IPv6 range.

Returns:The validity.
Return type:bool
is_ipv4()[source]

Checks if the given subject is a valid IPv4.

Returns:The validity.
Return type:bool
is_ipv4_range()[source]

Checks if the given subject is a valid IPv4 range.

Returns:The validity.
Return type:bool
is_ipv6()[source]

Checks if the given subject is a valid IPv6.

Returns:The validity.
Return type:bool
is_ipv6_range()[source]

Checks if the given subject is a valid IPv6 range.

Returns:The validity.
Return type:bool
is_reserved_ip()[source]

Checks if the given subject is a reserved IPv4 or IPv6.

Returns:The validity.
Return type:bool
is_reserved_ipv4()[source]

Checks if the given subject is a reserved IPv4.

Returns:The validity.
Return type:bool
is_reserved_ipv6()[source]

Checks if the given subject is a reserved IPv6.

Returns:The validity.
Return type:bool
is_subdomain()[source]

Checks if the given subject is a valid subdomain.

Returns:The validity.
Return type:bool
is_url(return_base=False, return_formatted=False)[source]

Checks if the given subject is a valid URL.

Parameters:
  • return_base (bool) – Allow us the return of the url base (if URL formatted correctly).
  • return_formatted (bool) – Allow us to get the formatted URL as response.
Returns:

The validity or the base if asked.

Return type:

bool, str