{"id":24716,"library":"tlds","title":"tlds","description":"Automatically updated list of valid top-level domains (TLDs) sourced directly from IANA. The package provides a simple set and list of all current TLDs. Version 2026041800 is a date-based version reflecting the IANA update date. Released approximately daily.","status":"active","version":"2026041800","language":"python","source_language":"en","source_url":"https://github.com/kichik/tlds","tags":["tld","domain","iana","top-level-domain","list","set"],"install":[{"cmd":"pip install tlds","lang":"bash","label":"latest from PyPI"}],"dependencies":[],"imports":[{"note":"Main export is a set of lowercase TLDs.","wrong":null,"symbol":"tlds_set","correct":"from tlds import tlds_set"},{"note":"List of all TLDs as strings.","wrong":null,"symbol":"tlds_list","correct":"from tlds import tlds_list"}],"quickstart":{"code":"from tlds import tlds_set, tlds_list\nprint('Number of TLDs:', len(tlds_set))\nprint('First 5:', list(tlds_set)[:5])\nprint('Is .com valid?', 'com' in tlds_set)","lang":"python","description":"Check if a domain extension is a valid TLD according to IANA."},"warnings":[{"fix":"Pin the version in requirements.txt: tlds==2026041800","message":"The TLD set is updated daily, so values can change between package versions. Do not rely on a specific version's set for security-critical checks without pinning the version.","severity":"gotcha","affected_versions":"all"},{"fix":"Use: domain_extension.lower() in tlds_set","message":"The set contains only the lowercase version of each TLD (e.g., 'com', not 'COM'). Always lowercase input before checking membership.","severity":"gotcha","affected_versions":"all"},{"fix":"Use idna package: from idna import encode; encode('münchen').decode() in tlds_set","message":"The set includes IDN TLDs in their punycode form (xn--...). If you expect an internationalized domain name, convert it to punycode before checking.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install tlds","cause":"The package is not installed or misspelled (e.g., 'tld' instead of 'tlds').","error":"ModuleNotFoundError: No module named 'tlds'"},{"fix":"Use: from tlds import tlds_set","cause":"Forgot to import the set; or imported from a different module.","error":"NameError: name 'tlds_set' is not defined"},{"fix":"Check each element: any(t.lower() == 'example' for t in tlds_list)","cause":"Trying to call .lower() on the list instead of iterating.","error":"AttributeError: 'list' object has no attribute 'lower'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}