Last active
July 22, 2022 12:29
-
-
Save azat/c1a7a9f1e3519793134ef4b1df5461a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import publicsuffix2 | |
import clickhouse_driver | |
ch = clickhouse_driver.Client(host='127.1') | |
pls = publicsuffix2.PublicSuffixList(idna=False) | |
def check_tld(tld): | |
print(tld) | |
host = 'foo.' + tld | |
ch_tld = ch.execute("SELECT cutToFirstSignificantSubdomainCustom(%(host)s, 'public_suffix_list')", params={ | |
'host': host, | |
})[0][0].strip() | |
py_tld = pls.get_public_suffix(host) | |
assert ch_tld == py_tld, f'ch_tld={ch_tld}, py_tld={py_tld}, host={host}' | |
tlds = pls.tlds | |
any(map(check_tld, tlds)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment