我尝试使用pywhois检查域可用性:
import pywhois
try:
w = pywhois.whois('domain_name')
message='Domain is available'
except:
message='Domain is not available'
但我收到此错误:
'module' object has no attribute 'whois'
我pywhois
用这个命令安装:
easy_install pywhois
它安装成功,我错过了什么?
编辑:
检查域可用性的最好和更稳定的方法是这样的:
try:
import socket
socket.gethostbyname_ex('domain_name')
message='Domain is not available'
except:
message='Domain is available'