pycountry
pycountry copied to clipboard
Add ccTLD information on Country data
Hello guys,
I would love to having TLD (Top Level Domain) information when getting a Country with pycountry
. For example:
>>> import pycountry
>>> brazil = pycountry.countries.get(alpha_3="BRA")
>>> brazil.tld
".br"
I've created a script using Geonames data (txt file link), and found only three countries where TLD is different from ISO-3166 (.alpha_2 property):
- BL is different of gp
- GB is different of uk
- MF is different of gp
Despite the small differences, they do exist 😢. If you agree with the idea, I can open a PR. We can do this in two ways:
- Adapting the
generate.py
to store the data directly into the iso3166-1.json file; or - Alternatively, creating a separate
tld_list.json
file and integrating it within the library class.
Thank you, Matheus Matos