Skip to main content

Yet another whois parser for Python

Project description

whois-parser

PyPI version Python CI Coverage Status

Yet another whois parser for Python. 🐍

  • Parse a whois record by using PyParsing not Regex.
  • Return a parsed record as dataclass not dict.

Installation

pip install whois-parser

Usage

import sh
from whois_parser import WhoisParser

# get whois record
hostname = "google.co.jp"
whois = sh.Command("whois")
raw_text = whois(hostname)

# parse whois record
parser = WhoisParser()
record = parser.parse(raw_text, hostname=hostname)
print(record)
# => WhoisRecord(raw_text="...", registrant=Registrant(organization='グーグル合同会社', email=None, name=None, telephone=None), admin=Admin(organization=None, email=None, name=None, telephone=None), tech=Tech(organization=None, email=None, name=None, telephone=None), abuse=Abuse(email=None, telephone=None), statuses=['Connected (2022/03/31)'], name_servers=['ns1.google.com', 'ns2.google.com', 'ns3.google.com', 'ns4.google.com'], domain='google.co.jp', registrar=None, expires_at=None, registered_at=datetime.datetime(2001, 3, 22, 0, 0), updated_at=datetime.datetime(2021, 4, 1, 1, 5, 22, tzinfo=<StaticTzInfo 'JST'>))

Customize / Contribution

Whois's responses will follow a semi-free text format. Thus, unfortunately, this library does not support all the formats in the wild.

You can create customized parsers to suit your needs. References are placed in whois-parser/parsers/.

Any contribution is welcome.

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

whois-parser-0.1.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

whois_parser-0.1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file whois-parser-0.1.1.tar.gz.

File metadata

  • Download URL: whois-parser-0.1.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.2 Darwin/20.6.0

File hashes

Hashes for whois-parser-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a06101cf002966cbccefbe34da19181d3097cc0271dc99a0bb80218e61e1bf24
MD5 ff1b1187814d473cdd0c9653d52d31b2
BLAKE2b-256 6d1c455823607d535a77bf8c5ffec7097ff915e6dd76ae250f4c9b7f6d99fdd1

See more details on using hashes here.

File details

Details for the file whois_parser-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: whois_parser-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.2 Darwin/20.6.0

File hashes

Hashes for whois_parser-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 52f0be31fb17d1e6b81d33a4f32fba614fc443ca37e420e8e823088989d8edf9
MD5 55b12683f3f1a59556920fc95c6a4897
BLAKE2b-256 9a97c350cf0ff9065a79742790e50880acef57f59c01fae4d4aea2a1adb36556

See more details on using hashes here.

Supported by

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