def check_domain(domain):
w = whois.whois(domain)
if w.status:
print(fThe domain {domain} is registered.)
else:
print(fThe domain {domain} is not registered.)
check_domain(example.com)
4、使用 API
有些域名注册商提供了 API 接口,可以直接通过编程方式查询域名状态。例如,GoDaddy 提供了这样的 API。