Skip to content

# URL Syntax

Syntax of a URL using the API

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21

    from PyFunceble import URLSyntaxChecker

    checker = URLSyntaxChecker()
    to_test = "https://github.com/pyfunceble"

    # You can do it this way.
    status = checker.set_subject(to_test).get_status()

    # Or this way.
    checker.set_subject(to_test)
    status = checker.get_status()

    # We can convert the status to json.
    status_json = status.to_json()

    # We can convert the status to dict.
    status_dict = status.to_dict()

    # We can ask "questions".
    print(f"Is {to_test} VALID ?", "yes" if status.is_valid() else "no")
    print(f"Is {to_test} INVALID ?", "yes" if status.is_invalid() else "no")