×

Python whois

What is whois?

Whois is a protocol used to identify the owner of the registered domain name. It is a querying database that is used to record the registered users.

WHOIS is a short form for “Who is responsible for this domain name?” and is not an acronym.

Python-whois module is used for this protocol, which is available at given below link:

https://pypi.python.org/pypi/python-whois.

It doesn’t have any external dependencies it only requires python’s standard library.

It is able to extract for all TLDs (org, com, net,...)

Features in whois

  1. Data retrieval
    • Ready to follow WHOIS server redirects
    • Will not stall out on multiple outcome responses from verisign-grs
  2. Data parsing
    • Registrant information
    • Date/time
    • Base information
    • Nameservers
  3. Pwhois
    • Output format which is easily redable
    • Output raw whois data
  4. Automated testing suite
    • Will distinguish and caution about any progressions in parsed information contrasted with past runs.
    • Ensures that already working WHOIS parsing doesn't inadvertently break while changing code
  5. Optional data normalization
    • Endeavors to intelligently reformat WHOIS information for better (human) readability.
    • Changes over different abbreviation types to full region names.

IP range

pythonwhois doesn't yet uphold WHOIS queries on IP ranges (counting single IPs), this will be added sooner or later. Meanwhile, consider utilizing ipwhois - it offers usefulness and an API like pythonwhois, yet for IPs. It additionally upholds appointed RWhois.

Do take note of that ipwhois doesn't offer a normalization feature, and doesn't (yet) accompany an command-line feature or tool. make a point to record bugs connecting with it in the ipwhois archive, not in that of pythonwhois.

Data sources

This library utilizes various outsider datasets for normalization:

Following datasets information are taken from github.com

  1. airports.dat: OpenFlights Airports Database (Open Database License 1.0, Database Contents License 1.0)
  2. countries.dat: Country List (MIT license)
  3. countries3.dat: ISO countries list (license unspecified)
  4. states_au.dat: Part of pythonwhois (WTFPL/CC0)
  5. states_us.dat: State Table (license unspecified, free reuse encouraged)
  6. states_ca.dat: State Table (license unspecified, free reuse encouraged)

Know that the OpenFlights data set specifically has potential permitting outcomes; in the event that you don't wish to be limited by these likely results, you may basically erase the airports.dat record from your distribution. pythonwhois will expect there is no information base accessible, and won't perform airport code conversion (yet work accurately in any case). This likewise applies to other included datasets.

How to install Pywhois?

To install pywhois you have to run this code in terminal

“pip install python-whois”

Now you just have to import it and you can perform that just by using

“import whois”

All TLDs and ccTLD support

  • ac.uk       
  • .am
  • .amsterdam
  • .ar
  • .at
  • .au
  • .aw
  • .bank
  • .be
  • .biz
  • .br
  • .by
  • .ca
  • .cc
  • .cl
  • .club
  • .cn
  • .co
  • .co.il
  • .co.jp
  • .com
  • .com.au
  • .com.tr
  • .courses
  • .cr
  • .cz
  • .de
  • .download
  • .edu
  • .education
  • .eu
  • .fi
  • .fm
  • .fr
  • frl
  • .game.ie
  • .im
  • .in
  • .info
  • .ink
  • .io
  • .ir
  • .is
  • .it
  • .jp
  • .kr
  • .kz
  • .link
  • .lt
  • .lv
  • .me
  • .ml
  • .mobi
  • .mu
  • .mx
  • .name
  • .net
  • .ninja
  • .nl
  • .nu
  • .nyc
  • .nz
  • .online
  • .org
  • .pe
  • .pharmacy
  • .pl
  • .press
  • .pt
  • .pub
  • .pw
  • .rest
  • .ru
  • .sale
  • .se
  • .security
  • .sh
  • .site
  • .space
  • .store
  • .study
  • .tech
  • .tel
  • .theatre
  • .tickets
  • .trade
  • .tv
  • .tz
  • .ua
  • .uk
  • .us
  • .uz
  • .video
  • .website
  • .wiki
  • .work
  • .xyz
  • .za
  • .id
  • .global
  • .hk

Is Whois illegal?

With the introduction of General Data Protection Regulation (GDPR) the implications are discussed widely and there is conflict between GDPR and WHOIS. GDPR doesn’t allow companies to publish individual’s data.

Presently, the WHOIS protocol distributes the names, locations, and telephone quantities of the people who register an Internet domain. However, this framework will become illegal under the GDPR, as it doesn't request the consent of these individuals prior to sharing their actually recognizable information.

implies that the current public WHOIS framework is incompatible with the data protection standards of the GDPR.

ICANN(Internet Corporation for Assigned Names and Numbers) reported that it would not make a legitimate move against domain registrars for neglecting to follow authoritative commitments with respect to the administration of registration data. As such, the company won't act against the individuals who don't distribute the WHOIS data until a long-lasting arrangement that lines up with the GDPR requirement has been found.

The Temporary Specification gives a single, unified interim model that guarantees a typical structure for dealing with registration data, including registration directory administrations (for example WHOIS). It plans to guarantee the proceeded accessibility of WHOIS furthest degree possible while keeping up with the security and stability of the Internet's arrangement of unique identifiers.

Support

Python 3.x is supported.
Python 2.x IS NOT supported.

How to use WHOIS?

$pip install whois


>>> import whois
>>> domain = whois.query('google.com')


>>> print(domain.__dict__)
{
    'expiration_date': datetime.datetime(2020, 9, 14, 0, 0),
    'last_updated': datetime.datetime(2011, 7, 20, 0, 0),
    'registrar': 'MARKMONITOR INC.',
    'name': 'google.com',
    'creation_date': datetime.datetime(1997, 9, 15, 0, 0)
}


>>> print(domain.name)
google.com


>>> print(domain.expiration_date)
2020-09-14 00:00:00

Related Topics

Working with JSON in Python

Python is an Object-Oriented high-level language. Python is designed to be highly beginner-friendly. Python has an English-like syntax, which is very easy to read. In this article, we are going...

4 minutes read.

Check if a String is Empty in Python

The string is one of the data types of Python. This data type stores all kinds of data but all the characters must be enclosed using double quotes (""). In...

5 minutes read.

Write a String in Python

Python is an object-oriented high-level programming language. Python has dynamic semantics and has high-level built-in data structures which support dynamic typing and dynamic binding. Python provides rapid development. It has...

5 minutes read.

Spark and Python for big data with pyspark github

Pyspark: Apache Spark is a computational engine that handles large data sets using parallel and batch processing. Apache Spark is an open-source, distributed computing framework and collection of libraries for real-time,...

3 minutes read.

How to append a string in python

Adding or appending a string to another string is easy in Python. It is called concatenation and is a basic concept of strings in almost all programming languages. Ways to Append...

4 minutes read.

Tensorflow Angular in Python

TensorFlow is an open-source, Python-compatible toolkit for numerical computation that accelerates and simplifies the creation of neural networks and machine learning algorithms. They make the interesting notion that models can be...

6 minutes read.

Cube Root in Python

In general, the cube is a three-dimensional solid figure that has 6 square faces. It is also called a geometrical shape with six equal faces, eight vertices, and twelve edges....

3 minutes read.

Python String ljust() method

Python String ljust() method The string.ljust() method in Python will left align the string, where the padding is done using the parameter fillchar (space is default). Syntax String.ljust(width[, fillchar]) Parameter width: This parameter represents the...

2 minutes read.

Python System Command

To execute a program in Python, we need to execute some shell commands to run our program on the computer. Python will provide some shell commands in our background to...

3 minutes read.

Python Fit Transform

In machine learning, fit (), transform(), fit transform () methods are provided by scikit learn package. This package is used in model fitting and data processing. These methods are implemented...

2 minutes read.

Python lambda() Function

In this tutorial, we will learn about a new concept known as the Lambda function. It is a relatively new concept while learning Python. Python lambda functions are anonymous functions. It...

3 minutes read.

How to import numy in python

How to Install NumPy in Python Python is a vast ocean of libraries, modules, and different functions. It has a solution for almost everything. Using Python, we can simplify even a...

3 minutes read.

Python History

Python is one of the top trending, widely-used programming languages. Python is a general-purpose programming language. Python language is known for its features. Some features are given below: SimplisticFree and open...

4 minutes read.

Unicode to String in Python

Python Python is an interactive and more accessible language than any other programming language. The python programming language uses a variety of libraries to perform the operations in a faster way....

3 minutes read.

How to get current date in python?

How to get current date in python? In Python programming language, date and time are not just a data form, but it is possible to import a method called datetime to operate...

3 minutes read.

What does the if __name__ == "__main__" do in Python

In this article, you will learn about the If__name__==__main__ is a statement in python to define modules and the names of the modules. This statement plays a vital role in...

3 minutes read.

Recursive Multiplication Python

Recursive Multiplication Python In this tutorial, we will learn how to write a Python program to get the multiplication of two numbers using the recursive approach. In the recursive multiplication approach, we...

2 minutes read.

Python Pickle

The pickle is a module that enables serialization and de-serialization of the structure of the object in python. Pickling is the process that uses the protocols to convert the Python...

5 minutes read.

os.stat() method in Python

In Python, the os module provides the capacity to interact with the operating system. The operating system comes under the Python module. In this module, Python provides a specific feature...

3 minutes read.

Python String startswith() method

Python String startswith() method The string.startswith() method in Python returns a boolean value ‘True’ if the given string starts with the prefix, otherwise it returns False. Syntax startswith(prefix[, start[, end]]) Parameter prefix: This parameter signifies the value to check. start(optional):...

1 minute read.