Skip to main content

Whois lookup using Proxy

Project description

Phois

ci

Whois lookup behind proxy using Python

Why use Phois over other libraries?

So why use Phois over robust libraries like pythonwhois, pywhois...

  1. It supports idn domains.

  2. It 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. It accepts http and socks proxies, thank to pysocks.

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

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

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

  7. Phois uses chardet library to detect encoding of whois and give you correctly utf-8 decoded result.

Getting started

Install dependencies

pip install phois

Copy phois folder anywhere you want then import it.

First create a Phois object

p = Phois()

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 Phois will use the authentic whois server for that domain tld
    see tests for more examples
from phois import *

# without proxy
try:
    p = Phois(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:
    print(str(err))
    
    
# with proxy
try:
    proxy_info = {'proxy_type':'http','addr':'localhost', 'port':8118}
    p = Phois(timeout=10, proxy_info=proxy_info)
    result = p.fetch(domain='github.com', whois_server=None,)
except Exception as err:
    print(str(err))
    
    
  • In many cases, when we query registrar whois server, we get full information but sometimes the registry whois sever gives us full information like 'php.guru', so we return both results

Exceptions

TldsFileError
BadDomainError
NoWhoisServerFoundError
SocketTimeoutError
SocketError
SocketBadProxyError

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phois-0.1.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phois-0.1.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file phois-0.1.0.tar.gz.

File metadata

  • Download URL: phois-0.1.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for phois-0.1.0.tar.gz
Algorithm Hash digest
SHA256 22b361a062349206716a1d21c6b86b188ef833a2156a7869c874b0c09d318e82
MD5 34b6a5b7d0f30542fa1c981517aee2fe
BLAKE2b-256 eb07871a64d3e8fa1ec3ab5e71255b6abb8d2ca50f200404e4986a10f7e767b5

See more details on using hashes here.

File details

Details for the file phois-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: phois-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for phois-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d26c72f19c0305ee53c2bbcbaefb5e4cfe1087f222df7443ce6df278488e9caa
MD5 ac0a57b0dba0c9f09474669b29839dd4
BLAKE2b-256 0900b6d3ab501511a6fe4879a8e661b7983de1ec7b128608e8b664981e58e7c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page