File: advanced.py

package info (click to toggle)
python-pyfunceble 4.2.29.dev-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,108 kB
  • sloc: python: 27,413; sh: 142; makefile: 27
file content (30 lines) | stat: -rw-r--r-- 1,014 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
This is an advanced example which get more information about the tested element.
"""

from PyFunceble import DomainAndIPAvailabilityChecker, URLAvailabilityChecker

SUBJECTS = ["google.com", "github.com", "example.org", "9.9.9.10", "149.112.112.10"]


if __name__ == "__main__":
    domain_ip_avail_checker = DomainAndIPAvailabilityChecker(use_whois_lookup=False)
    url_avail_checker = URLAvailabilityChecker()

    for subject in SUBJECTS:
        domain_ip_avail_checker.subject = subject
        url_avail_checker.subject = f"https://{subject}"

        domain_ip_status = domain_ip_avail_checker.get_status()
        url_status = url_avail_checker.get_status()

        print(
            f"============== COMPLETE DATA: {domain_ip_avail_checker.subject} "
            "=============="
        )
        print(domain_ip_status.to_json(), "\n\n")

        print(
            f"============== COMPLETE DATA: {url_avail_checker.subject} =============="
        )
        print(url_status.to_json(), "\n\n")