【问题标题】:how to use pywhois module in gae如何在 gae 中使用 pywhois 模块
【发布时间】:2011-11-07 10:45:51
【问题描述】:

我在尝试导入pywhois module 时遇到问题,我可以导入自己的模块,但在导入 pywhois 时仍然遇到问题。我在我的项目文件夹domain中移动了pywhois文件夹,截图如下:

这是下面的导入和调用语句: 导入部分:

from pywhois import *

调用部分:

 w = whois('hackbo.com')
 self.response.out.write(w)

问题是它总是会抛出一个http 500错误,错误文本如下:

Traceback (most recent call last):
  File "/home/li/Desktop/google_appengine/google/appengine/ext/webapp/__init__.py", line 700, in __call__
    handler.get(*groups)
  File "/home/li/Desktop/google_appengine/domain/main.py", line 43, in get
    w = whois('hackbo.com')
  File "pywhois/__init__.py", line 12, in whois
    text = nic_client.whois_lookup(None, domain, 0)
  File "pywhois/whois.py", line 157, in whois_lookup
    result = self.whois(query_arg, nichost, flags)
  File "pywhois/whois.py", line 100, in whois
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
AttributeError: 'module' object has no attribute 'socket'

这个错误是什么意思?为什么我可以导入自己的模块却不能导入 pywhois?

【问题讨论】:

标签: python google-app-engine pywhois


【解决方案1】:

Google App Engine 不支持 pywhois 使用的 socket 模块。它允许你import socket,但it's an empty module

【讨论】:

    【解决方案2】:
    import whois
    site = input ("Enter Site : ")
    n = whois.whois (site)
    print (n)
    

    这是最好的whois
    尽情享受吧,轻松。

    【讨论】:

    • 格式化您的答案并添加一些描述
    • 安装 Cmder 类型:cd desktop 或(查找您的 whois 文件)并输入您的文件名,例如(cd desktop、cd python、whois.py)并输入您的站点:
    猜你喜欢
    • 2012-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-10
    • 2014-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多