Enpoints

Note

This section document what you can call directly when you use PyFunceble as an imported module.

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

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

This submodule is the main entry of PyFunceble.

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 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.
PyFunceble.dns_lookup(subject, dns_server=None, complete=False)[source]

Make a DNS lookup of the given subject.

Parameters:
  • subject (str) – The subject we are working with.
  • dns_server (str|int) – A (or list of) DNS server to use while resolving.
  • complete (bool) – Tell us to look for everything instead of NS only.
Returns:

A dict with following index if the given subject is not registered into the given DNS server. (More likely local subjects).

{
    "hostname": "",
    "aliases": [],
    "ips": []
}

A dict with following index for everything else (and if found).

{
    "A": [],
    "AAAA": [],
    "CNAME": [],
    "MX": [],
    "NS": [],
    "TXT": [],
    "PTR": []
}

Return type:

dict

PyFunceble.ipv4_syntax_check(ip)[source]

Check the syntax of the given IPv4.

Parameters:ip (str|list) – The IPv4 to check the syntax for.
Returns:The syntax validity.
Return type:bool|dict

Warning

This method will be deprecated one day in the future.

Please report to is_ipv4().

PyFunceble.is_domain(subject)[source]

Check if the given subject is a syntactically valid domain.

Parameters:subject (str|list) – The subject to check the syntax from.
Returns:The syntax validity.
Return type:bool|dict
PyFunceble.is_ipv4(subject)[source]

Check if the given subject is a syntactically valid IPv4.

Parameters:subject (str|list) – The subject to check the syntax from.
Returns:The syntax validity.
Return type:bool|dict
PyFunceble.is_ipv4_range(subject)[source]

Check if the given subject is a syntactically valid IPv4 range.

Parameters:subject (str|list) – The subject to check the syntax from.
Returns:The IPv4 range state.
Return type:bool|dict
PyFunceble.is_subdomain(subject)[source]

Check if the given subject is a syntactically valid subdomain.

Parameters:subject (str|list) – The subject to check the syntax from.
Returns:The syntax validity.
Return type:bool|dict
PyFunceble.is_url(subject)[source]

Check if the given subject is a syntactically valid URL.

Parameters:subject (str|list) – The subject to check the syntax from.
Returns:The syntax validity.
Return type:bool|dict
PyFunceble.load_config(generate_directory_structure=False, custom=None)[source]

Load the configuration.

Parameters:
  • generate_directory_structure (bool) – Tell us if we generate the directory structure along with loading the configuration file.
  • custom (dict) – A dict with the configuration index (from .PyFunceble.yaml) to update.

Note

If config is given, the given dict overwrite the last value of the given indexes in the configuration.

It’s actually something like following:

pyfunceble.configuration.update(config_given_by_user)
PyFunceble.syntax_check(domain)[source]

Check the syntax of the given domain.

Parameters:domain (str|list) – The domain to check the syntax from.
Returns:The syntax validity.
Return type:bool|dict

Warning

This method will be deprecated one day in the future.

Please report to is_domain().

PyFunceble.test(subject, complete=False, config=None)[source]

Test the availability of the given subject (domain or IP).

Parameters:
  • subject (str|list) – The subject (IP or domain) to test.
  • complete (bool) – Activate the return of a dict with some significant data from the test.
  • config (dict) – A dict with the configuration index (from .PyFunceble.yaml) to update.
Returns:

The status or the informations of the domain.

Return type:

str|dict

Note

If config is given, the given dict overwrite the last value of the given indexes in the configuration.

It’s actually something like following:

pyfunceble.configuration.update(config_given_by_user)

Note

If complete is set to True, we return the following indexes.

{
    "_status_source": None,
    "_status": None,
    "domain_syntax_validation": None,
    "expiration_date": None,
    "http_status_code": None,
    "ip4_syntax_validation": None,
    "dns_lookup": [],
    "status_source": None,
    "status": None,
    "tested": None,
    "url_syntax_validation": None,
    "whois_record": None,
    "whois_server": None,
}
PyFunceble.url_syntax_check(url)[source]

Check the syntax of the given URL.

Parameters:url (str|list) – The URL to check the syntax for.
Returns:The syntax validity.
Return type:bool|dict

Warning

This method will be deprecated one day in the future.

Please report to is_url().

PyFunceble.url_test(subject, complete=False, config=None)[source]

Test the availability of the given subject (URL).

Parameters:
  • subject (str|list) – The subject (URL) to test.
  • complete (bool) – Activate the return of a dict with some significant data from the test.
  • config (dict) – A dict with the configuration index (from .PyFunceble.yaml) to update.
Returns:

The status or the informations of the URL.

Return type:

str|dict

Note

If config is given, the given dict overwrite the last value of the given indexes in the configuration.

It’s actually something like following:

pyfunceble.configuration.update(config_given_by_user)
PyFunceble.whois(subject, server=None, timeout=3)[source]

Request the WHOIS record of the given subject.

Parameters:
  • subject (str) – The subject we are working with.
  • server (str) –

    The WHOIS server to communicate with.

    Note

    If None is given, we look for the best one.

  • timeout (int) – The timeout to apply to the request.
Returns:

None or the WHOIS record.

Return type:

None|str