Using Python for whois queries __python

Source: Internet
Author: User
Tags aliyun
using python for whois queries installing whois with the PIP command

Pip Install Python-whois

Python 2.7.6 (default, OCT 2016, 20:30:19) 
[GCC 4.8.4] on linux2
Type ' help ', ' copyright ', ' credits ' or ' Licens E "For more information.
" >>> import whois
>>>

How to use the installation successfully

[GCC 4.8.4] on linux2
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
>>> Import whois

Use

Whois.whois (URL)

To query the WHOIS information for the domain name

>>> data = Whois.whois ("Www.wangjunx.top")
>>> data
{u ' updated_date ': Datetime.datetime ( 2017, 7, 6, 2,,, U ' status ': U ' OK Https://icann.org/epp#OK ', U ' name ': U ' Wang June xiong ', U ' dnssec ': U ' unsigned ', U ' c ity ': U ' hangzhou ', U ' expiration_date ': Datetime.datetime (2018, 7, 6, 2, 8), U ' zipcode ': U ' 311121 ', U ' domain_name ': U ' W Angjunx.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.9  Liang Mu Road Yuhang District ', U ' name_servers ': [u ' dns7.hichina.com ', U ' dns8.hichina.com '], u ' org ': U ' Wang June Xiong ', U ' creation_date ': Datetime.datetime (2017, 7, 6, 2, 8), U ' emails ': [u ' DomainAbuse@service.aliyun.com ', U ' 1411349759@ Qq.com ', U ' YuMing@YinSiBaoHu.AliYun.com ']}

The resulting WHOIS server returns information (class)

>>> type (data)
<class ' Whois.parser.WhoisEntry ' >

Get the corresponding keyword information

>>> data[' city ']
u ' Hangzhou '

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.