您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

您建议使用哪种Python方法检查whois数据库记录?

您建议使用哪种Python方法检查whois数据库记录?

使用命令行实用程序执行所需的操作没有错。如果您在服务周围包装好包装,则可以根据需要实现内部结构!例如:

class Whois(object):
    _whois_by_query_cache = {}

    def __init__(self, query):
        """Initializes the instance variables to defaults. See :meth:`lookup`
        for details on how to submit the query."""
        self.query = query
        self.domain = None
        # ... other fields.

    def lookup(self):
        """Submits the `whois` query and stores results internally."""
        # ... implementation

现在,无论您是否使用urllib进行滚动,环绕命令行实用程序(如您所做的事情)还是导入第三方库并使用它,此接口都保持不变。

通常根本不认为这种方法很丑陋- 。如果速度最终成为瓶颈,那么您的抽象将使切换到本地Python实现的过程对您的客户端代码透明。

实用性胜过纯洁-这就是Pythonic。:)

python 2022/1/1 18:38:23 有241人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶