Add 'format' setting, so that users can set data format for each whois server. .com support. Bug fix.

This commit is contained in:
Larry Kim 2013-02-22 15:09:44 +09:00
parent 7b49fb2a74
commit ae1e769272
3 changed files with 20 additions and 2 deletions

View File

@ -123,6 +123,7 @@ class Parser(object):
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)}) result.update({key: map(lambda x: x.strip(), matches)})
else:
logging.debug("run: No match for %s"%(key)) logging.debug("run: No match for %s"%(key))
print result print result

View File

@ -0,0 +1,13 @@
server = {
"redirect": "\s+Whois Server: (.*)",
"format": {
"com.whois-servers.net": "domain %DOMAIN%",
"whois.verisign-grs.com": "domain %DOMAIN%",
},
}
parse = {
"default": {
"LoadConf": "net/default",
},
}

View File

@ -64,6 +64,10 @@ class Whois(object):
logging.error("sendQuery: Error connecting to whois server %s"%(whoisServer)) logging.error("sendQuery: Error connecting to whois server %s"%(whoisServer))
return False return False
try:
msg = self.settings['format'][whoisServer].replace("%DOMAIN%", self.domain) + "\r\n"
except:
msg = self.domain + "\r\n" msg = self.domain + "\r\n"
logging.debug("sendQuery: Sending data.. %s"%(msg)) logging.debug("sendQuery: Sending data.. %s"%(msg))