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
, runpip
with theinstall
command and the--editable
option.
sudo pip install --editable .[test]
-
Clone or download this repository.
-
Using
sudo
, runpip
with theinstall
command.
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
TopLevelDomainGetter
andwrite_results
. - Instantiate
TopLevelDomainGetter
and call itsget
method. - Call the
write_results
function.
from tlds import (
TopLevelDomainGetter,
write_results
)
tld_getter = TopLevelDomainGetter()
tlds = tld_getter.get()
write_results(tlds)
- Run
radon
with themi
command and the--show
option.
radon mi --show tlds
- Run
flake8
with the--count
option.
flake8 --count tlds
- Run
pytest
with with-vv
,--cov
, andcov-report
options.
pytest -vv --cov --cov-report=term-missing