I tryed to use pywhois to check domain availability:
import pywhois
try:
w = pywhois.whois('domain_name')
message='Domain is available'
except:
message='Domain is not available'
but I get this error:
'module' object has no attribute 'whois'
I installed pywhois
with this command:
easy_install pywhois
It was installed successfully,what I missed?
Edit:
the best and more stable way to check domain availability is this way:
try:
import socket
socket.gethostbyname_ex('domain_name')
message='Domain is not available'
except:
message='Domain is available'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…