From 628f96d293b3a3d54e6d071bac7ae08fd68ae640 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Wed, 28 Feb 2018 16:17:40 +1100 Subject: [PATCH] Finished basic addition of uk domain lookups, need to figure out how to properly do it --- tests/out.txt | 2 ++ tests/runTest.py | 2 +- whois/parser.py | 3 +-- whois/tlds/uk | 20 ++++++++++---------- 4 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 tests/out.txt diff --git a/tests/out.txt b/tests/out.txt new file mode 100644 index 0000000..435a6bf --- /dev/null +++ b/tests/out.txt @@ -0,0 +1,2 @@ +['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'chooseServer', 'query', 'sendHTTPQuery', 'sendQuery'] +{'Status': ['Registered until expiry date.'], 'UpdatedDate': ['29-Apr-2017'], 'Registrar': ['Nom-IQ Limited t/a Com Laude [Tag = NOMIQ]'], 'ExpirationDate': ['03-May-2018'], 'DomainName': ['amamzon.co.uk'], 'NameServer': ['pdns1.ultradns.net'], 'CreationDate': ['03-May-2001'], 'RegistrantName': ['Amazon Europe Core S.?.r.l.']} diff --git a/tests/runTest.py b/tests/runTest.py index 7e784ba..e564956 100644 --- a/tests/runTest.py +++ b/tests/runTest.py @@ -6,7 +6,7 @@ from whois import whois from whois import parser print dir(whois) -domain = "example.com" +domain = "amamzon.co.uk" w = whois(domain, True) t = w.query(False) p = parser.Parser(domain, t[1], t[0], True) diff --git a/whois/parser.py b/whois/parser.py index 2b111cc..c14667a 100644 --- a/whois/parser.py +++ b/whois/parser.py @@ -134,9 +134,8 @@ class Parser(object): for key in self.parseConf: matches = re.findall(self.parseConf[key], self.text, re.MULTILINE) if matches: - logging.debug("run: regex matches found for key %s. %s"%(key, matches)) + logging.debug("run: regex matches found for key %s. %s"%(key, matches)) result.update({key: map(lambda x: x.strip(), matches)}) - else: logging.debug("run: No match for %s"%(key)) diff --git a/whois/tlds/uk b/whois/tlds/uk index 1608b3c..d8dd84e 100644 --- a/whois/tlds/uk +++ b/whois/tlds/uk @@ -5,20 +5,20 @@ server = { parse = { "default": { - "NotFound": "No Data Found", - "DomainName": "Domain name:\s+(.+)", - "Registrar": "Registrar Name:\s+(.+)", + "NotFound": "No match for", + "DomainName": "Domain name:\s+(.+|\n)", + "Registrar": "Registrar:\s+(.+)", "NameServer": "Name servers:\s+(.+)", "Status": "Registration status:\s+(.+)", "UpdatedDate": "Last updated:\s+(.+)", "CreationDate": "Registered on:\s+(.+)", "ExpirationDate": "Expiry date:\s+(.+)", -# "RegistrantName": "Registrant:(.+)", - "EligibilityName": "Registrant:\s+(.+)", - "EligibilityType": "Eligibility Type:(.+)", - "AdminID": "Registrant Contact ID:(.+)", - "AdminName": "Registrant Contact Name:(.+)", - "TechName": "Tech Contact Name:(.+)", - "TechID": "Tech Contact ID:(.+)", + "RegistrantName": "Registrant:\s(.+)", +# "EligibilityName": "Registrant:\s+(.+)", +# "EligibilityType": "Eligibility Type:(.+)", +# "AdminID": "Registrant Contact ID:(.+)", +# "AdminName": "Registrant Contact Name:(.+)", +# "TechName": "Tech Contact Name:(.+)", +# "TechID": "Tech Contact ID:(.+)", }, }