First version of the DomainClassifier

This commit is contained in:
Alexandre Dulaunoy 2014-09-08 16:43:21 +02:00
parent 3055b0deae
commit 246621f663

View file

@ -44,6 +44,9 @@ def main():
subscriber_name = "DomainClassifier" subscriber_name = "DomainClassifier"
subscriber_config_section = "PubSub_Global" subscriber_config_section = "PubSub_Global"
cc = cfg.get("PubSub_DomainClassifier", "cc")
cc_tld = cfg.get("PubSub_DomainClassifier", "cc_tld")
sub = ZMQ_PubSub.ZMQSub(configfile, subscriber_config_section, channel, subscriber_name) sub = ZMQ_PubSub.ZMQSub(configfile, subscriber_config_section, channel, subscriber_name)
# FUNCTIONS # # FUNCTIONS #
@ -71,10 +74,10 @@ def main():
c.text(rawtext=paste) c.text(rawtext=paste)
c.potentialdomain() c.potentialdomain()
c.validdomain(rtype=['A'],extended=True) c.validdomain(rtype=['A'],extended=True)
localizeddomains = c.include(expression=r'\.lu$') localizeddomains = c.include(expression=cc_tld)
if localizeddomains: if localizeddomains:
print (localizeddomains) print (localizeddomains)
localizeddomains = c.localizedomain(cc='LU') localizeddomains = c.localizedomain(cc=cc)
if localizeddomains: if localizeddomains:
print (localizeddomains) print (localizeddomains)
except IOError: except IOError: