diff --git a/whois/parser.py b/whois/parser.py index 60bceeb..4cb2d32 100644 --- a/whois/parser.py +++ b/whois/parser.py @@ -8,6 +8,7 @@ import error import re +import sys class Parser(object): def __init__(self, domain, text, whoisServer=None): @@ -28,21 +29,43 @@ class Parser(object): self.parseConf = self.parseConf.get("parse") + # NO "parse" in the tld config AND YES regex for specified server in default conf + if not self.parseConf and whoisServer not in self.parseDefaultConf: self.parseConf = self.parseDefaultConf.get("default") + # END + # + # NO "parse" in the tld config + elif not self.parseConf: self.parseConf = self.parseDefaultConf.get(whoisServer) + # END + # + # YES "parse" in the tld config AND YES regex for specified server + elif self.whoisServer in self.parseConf: self.parseConf = self.parseConf.get(self.whoisServer) + # END + # + # YES "parse" in the tld config AND YES "default" regex in the tld config AND + # NO regex for specified server + elif "default" in self.parseConf: self.parseConf = self.parseConf.get("default") + # END + # + # YES "parse" in the tld config AND NO "default" regex in the tld config + # MAYBE empty file? + else: self.parseConf = self.parseDefaultConf.get("default") + # END + # Check for LoadConf _parseConf = self.parseConf self.parseConf = {} diff --git a/whois/tlds/so b/whois/tlds/so index e69de29..a6bbc7b 100644 --- a/whois/tlds/so +++ b/whois/tlds/so @@ -0,0 +1,15 @@ +server = { + "host": "whois.nic.so" +} + +parse = { + "default": + { + "LoadConf": "default/default", + "UpdatedDate": "Last Updated On:\s+(.+)", + "RegistrantID": "Registrant ID:\s+(.+)", + "AdminContactID": "Admin Contact ID:\s+(.+)", + "BillingContactID": "Billing Contact ID:\s+(.+)", + "TectContactID": "Tech Contact ID:\s+(.+)", + } +} diff --git a/whois/whois.py b/whois/whois.py index 9bc9ef0..43e46be 100644 --- a/whois/whois.py +++ b/whois/whois.py @@ -32,7 +32,7 @@ class Whois(object): self.settings.update(_settings["server"]) def chooseServer(self): - if "server" in self.settings: + if "host" in self.settings: return self.settings["host"] else: return self.tld + ".whois-servers.net"