发布时间:2019-09-16 07:33:29编辑:auto阅读(2551)
pip install python-whois
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import whois
>>>
安装成功
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import whois
使用
whois.whois(URL)
来查询域名的whois信息
>>> data = whois.whois("www.wangjunx.top")
>>> data
{u'updated_date': datetime.datetime(2017, 7, 6, 2, 12, 42), u'status': u'ok https://icann.org/epp#OK', u'name': u'Wang Jun Xiong', u'dnssec': u'unsigned', u'city': u'Hangzhou', u'expiration_date': datetime.datetime(2018, 7, 6, 2, 12, 8), u'zipcode': u'311121', u'domain_name': u'wangjunx.top', u'country': u'CN', u'whois_server': u'http://whois.hichina.com/', u'state': u'Zhejiang', u'registrar': u'Alibaba Cloud Computing Ltd. d/b/a HiChina (www.net.cn)', u'referral_url': None, u'address': u'Le Jia International No.999 Liang Mu Road Yuhang District', u'name_servers': [u'dns7.hichina.com', u'dns8.hichina.com'], u'org': u'Wang Jun Xiong', u'creation_date': datetime.datetime(2017, 7, 6, 2, 12, 8), u'emails': [u'DomainAbuse@service.aliyun.com', u'1411349759@qq.com', u'YuMing@YinSiBaoHu.AliYun.com']}
得到的whois服务器返回的信息(class)
>>> type(data)
<class 'whois.parser.WhoisEntry'>
得到对应的关键字信息
>>> data['city']
u'Hangzhou'
上一篇: python安装各种插件
下一篇: 非root用户安装安装python-3.
47842
46390
37283
34733
29313
25973
24916
19951
19545
18030
5792°
6413°
5927°
5961°
7064°
5911°
5944°
6438°
6404°
7778°