.so support. Use server['host'] instead of server['server'] for whois server address. Add some comments.
This commit is contained in:
parent
11e10b2e86
commit
3b146340e1
@ -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 = {}
|
||||
|
||||
@ -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+(.+)",
|
||||
}
|
||||
}
|
||||
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user