python whois Windows 版

发布于 2024-09-13 08:11:04 字数 200 浏览 0 评论 0原文

我尝试在 python 中获取 whois 。我用这个 http://code.google.com/p/pywhois/ 但它只能在linux下运行。可以在windows上运行吗?目前我收到错误(因为使用了内部linux命令whois)

I try to get whois in python. I use this
http://code.google.com/p/pywhois/
but it run only in linux. Is it posible to run it on windows? currently i get errors (because internal linux command whois used)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南汐寒笙箫 2024-09-20 08:11:04

在 Windows 上,就像在 Linux 上一样,如果未安装 whois 程序,pywhois 会给出错误。例如,您可以尝试此whois

当然,原因在于 pywhois/ init.py,第 11 行:

r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE)

显然,这一行需要运行一些现有的、已安装的 whois 命令行程序(它接受要作为命令行参数进行查找的域) ,无论它运行在什么操作系统上。

On Windows just like on Linux, pywhois gives an error if the whois program is not installed. You could try this whois, for example.

The reason, of course, is in pywhois/init.py, line 11:

r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE)

Clearly this line needs to run some existing, installed whois command-line program (which accepts the domain to look up as a commandline argument), whatever OS it's running on.

雨落星ぅ辰 2024-09-20 08:11:04

您可以使用:

os.system("whois %s" % hostname)

或使用urllib连接http://www.whois.net 并废弃内容。

You could use :

os.system("whois %s" % hostname)

Or use urllib to connect http://www.whois.net and scrap content.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文