.net support. Add test feature in parser.py.
This commit is contained in:
parent
c57b2726d8
commit
11e10b2e86
@ -70,11 +70,13 @@ class Parser(object):
|
||||
except:
|
||||
self.parseConf = self.parseDefaultConf.get("default")
|
||||
|
||||
def run(self):
|
||||
def run(self, TEST=False):
|
||||
result = {}
|
||||
for key in self.parseConf:
|
||||
matches = re.findall(self.parseConf[key], self.text, re.MULTILINE)
|
||||
if matches:
|
||||
result.update({key: map(lambda x: x.strip(), matches)})
|
||||
|
||||
if TEST and not matches: print "No match for %s"%(key)
|
||||
|
||||
print result
|
||||
|
||||
@ -1,11 +1,18 @@
|
||||
server = {
|
||||
"host": "net.whois-servers.net",
|
||||
"redirect": ".*Whois Server: (.*)",
|
||||
"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":
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user