From f82199192b47e5e85dd91e80f99d343a8638086b Mon Sep 17 00:00:00 2001 From: Larry Kim Date: Tue, 21 May 2013 20:50:54 +0900 Subject: [PATCH] .jp support --- README.md | 33 +++++++++++++++++++++++++++++---- whois/tlds/jp | 23 +++++++++++++++++++++++ 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index be12196..2c0ef00 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,15 @@ The whois library, which is developed in Python language, retrieves domain infor Quick start ----------- -Install the library +Install the library. python setup.py install -Run Python interpreter +Run Python interpreter. python -To get whois data of example.com +To get whois data of example.com, import whois whoisData = whois.whois("example.com").query() @@ -23,9 +23,34 @@ whois.whois will return tuple type, which contains whois server address and the To parse whois data, - result = whois.parser("example.com", whoisData[1]) + result = whois.Parser("example.com", whoisData[1]).parse() Some whois servers of top level domains (like .com and .net) send redirect command in order to let clients to get more information, like address and phone number, from whois server of domain reseller. However, all whois servers have all different data format. So if you want parse the whois data more accurately, I recommend to set "redirect" parameter to `False` when querying, or if you want detailed information, please add data format of the whois server to tld config file and make a pull request. Config file structure ----------- + + server = { + "host": "net.whois-servers.net", + "redirect": "\s+Whois Server: (.*)", + } + + parse = { + "default": { + "NotFound": "No match for domain", + "DomainName": "Domain Name:\s+(.+)", + "Registrar": "Registrar:\s+(.+)", + "NameServer": "Name Server:\s+(.+)", + "Status": "Status:\s+(.+)", + "UpdatedDate": "Updated Date:\s+(.+)", + "CreationDate": "Creation Date:\s+(.+)", + "ExpirationDate": "Expiration Date:\s+(.+)", + }, + "whois.dotname.co.kr": + { + + }, + } + + + diff --git a/whois/tlds/jp b/whois/tlds/jp index e69de29..8e04179 100644 --- a/whois/tlds/jp +++ b/whois/tlds/jp @@ -0,0 +1,23 @@ +server = { + "format": { + "jp.whois-servers.net": "%DOMAIN%/e", + } +} + +parse = { + "default": { + "NotFound": "No match!!", + "DomainName": "\[Domain Name\]\s+(.+)", + "RegistrantName": "\[Registrant\]\s+(.+)", + "RegistrantAddress": "\[Postal Address\]\s+([\S\s]*)\n\[Phone\]", + "RegistrantPostralCode": "\[Postal code\]\s+(.+)", + "RegistrantEmail": "\[Email\]\s+(.+)", + "RegistrantPhone": "\[Phone\]\s+(.+)", + "RegistrantFax": "\[Fax\]\s+(.+)", + "CreationData": "\[Created on\]\s+(.+)", + "ExpirationDate": "\[Expires on\]\s+(.+)", + "UpdatedDate": "\[Last Updated\]\s+(.+)", + "NameServer": "\[Name Server\]\s+(.+)", + "Status": "\[Status\]\s+(.+)", + } +}