使用pywhois时出错 [英] error when using pywhois

查看:1238
本文介绍了使用pywhois时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 pywhois 检查域名可用性:

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'

但是我得到这个错误:

'module' object has no attribute 'whois'

我使用此命令安装了 pywhois

easy_install pywhois

安装成功,我错过了什么?


编辑:
以这种方式检查域可用性的最佳和更稳定的方式是:

It was installed successfully,what I missed?
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'


推荐答案

easy_install pywhois 

安装不同的工具 - 它是一个CLI工具 - http://pypi.python.org/pypi/pywhois
要安装所需的pywhois python lib,请从googlecode中查看(hg clone https:// code.google.com/p/pywhois/ )或github(git clone https:// github .com / unpluggd / pywhois.git

installs a different tool - it is a CLI tool - http://pypi.python.org/pypi/pywhois. To install the desired pywhois python lib, check it out from googlecode(hg clone https://code.google.com/p/pywhois/) or github (git clone https://github.com/unpluggd/pywhois.git)

从源目录运行

python setup.py install

这篇关于使用pywhois时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆