py-tlds is a util that retrieves and validates a list of top-level domains (TLDs) from the Internet Assigned Names Authority.
py-tlds requires Python 3.x and the pip package. It also requires the following packages for usage and testing.
Usage:
- click
- requests
Testing:
- coveralls
- flake8
- pytest
- pytest-cov
- radon
- responses
-
Clone or download this repository.
-
Using
sudo, runpipwith theinstallcommand and the--editableoption.
sudo pip install --editable .[test]
-
Clone or download this repository.
-
Using
sudo, runpipwith theinstallcommand.
sudo pip install .
To retrieve and validate a list of TLDs, simply run tlds.
tlds
To write the results to disk, run tlds with either the --write or the -w option.
tlds --write
tld -w
- Import
TopLevelDomainGetterandwrite_results. - Instantiate
TopLevelDomainGetterand call itsgetmethod. - Call the
write_resultsfunction.
from tlds import (
TopLevelDomainGetter,
write_results
)
tld_getter = TopLevelDomainGetter()
tlds = tld_getter.get()
write_results(tlds)
- Run
radonwith themicommand and the--showoption.
radon mi --show tlds
- Run
flake8with the--countoption.
flake8 --count tlds
- Run
pytestwith with-vv,--cov, andcov-reportoptions.
pytest -vv --cov --cov-report=term-missing