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

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

您建议使用哪种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。:)



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5674889.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存