Whois with Proxy for Python
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
pois cleanup Oct 31, 2018
tests add tests Sep 4, 2018
.gitignore Initial commit Feb 7, 2018
README.md add doc Aug 25, 2018



Whois client for Python with Proxy

Why use Pois over other libraries?

so why use Pois over robust libraries like pythonwhois, pywhois...

  1. Pois supports idn domains.

  2. Pois supports over 1449 tlds (thanks to dnpedia) and if it didn't find any whois server for a specific brand new tld it query whois.iana.org to get tld whois server (tlds.json file will be updated when new whois servers fetched)

  3. Pois accept http and socks proxies, thank to pysocks

  4. Pois accepts user defined whois server to query desired domain

  5. Pois accepts a timeout for whois operation, some whois servers time out after user quota exceeded

  6. Pois parses result and if it finds a Registrar whois server, re-whois that server to get complete whois (thick whois)

  7. Pois uses fantastic chardet library to detect encoding of whois and give you correctly utf-8 decoded result. for example if you use other libraries to get whois of cloudpbx.com.tr you see REPLACEMENT_CHARACTER inside result that's because they just decode result to utf-8 and replace undecodable characters.

Getting started

Install pysocks and tlddextract

pip install pysocks tldextract chardet

copy pois folder anywhere you want then import it. first create a Pois object

p = Pois()

You can set a timeout for whois operation by passing timeout argument, timeout must be an integer
to set proxy just pass proxy_info dict with these arguments

  • proxy_type: must be http,socks4 or socks5
  • addr: server ip or address
  • username: proxy username if specified
  • password: proxy password if specified
  • port: proxy port in integer

to fetch whois of domain just call fetch method, this method take two arguments, domain and whois_server

  • domain is the domain that you want to fetch whois of
  • whois_server is the whois server that you want to query the domain on that server, if set to None Pois will use the authentic whois server for that domain tld
    see tests for more examples
from pois import *

# without proxy
    p = Pois(timeout=10)
    result = p.fetch(domain='github.com', whois_server='whois.verisign-grs.com')
    # or
    result = p.fetch(domain='github.com',)
except Exception as err:
# with proxy
    proxy_info = {'proxy_type':'http','addr':'localhost', 'port':8118}
    p = Pois(timeout=10, proxy_info=proxy_info)
    result = p.fetch(domain='github.com', whois_server=None,)
except Exception as err:
  • in many cases, when we query registrar whois server we get full information but sometimes the registry whois sever give us full information like 'php.guru', so we return both results


TldsFileError, BadDomainError, NoWhoisServerFoundError, SocketTimeoutError, SocketError, SocketBadProxyError