From b5bfadb368ba0272cea2e40043d0606f4f7b0205 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 24 Jan 2012 11:58:00 +0100 Subject: [PATCH] Update README to match new DomainClassifier --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 27f890b..a032e63 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,35 @@ DomainClassifier DomainClassifier is a simple Python library to extract and classify Internet domains from raw text files following their existence, localization or attributes. +How To Use It +------------- +```python +import domainclassifier + +c = domainclassifier.Extract( rawtext = "this is a text with a domain called test@foo.lu another test abc.lu something a.b.c.d.e end of 1.2.3.4 foo.be www.belnet.be http://www.cert.be/ www.public.lu www.allo.lu quuxtest www.eurodns.com something-broken-www.google.com www.google.lu trailing test") + +# extracting potentially valid domains from rawtext +print c.domain() + +# reduce set of potentially valid domains to existing domains +# (based on SOA,A,AAAA,CNAME,MX records) +print c.validdomain(extended=True) + +# reduce set of valid domains with DNS records associated to a +# specified country +print "US:" +print c.localizedomain(cc='US') +print "LU:" +print c.localizedomain(cc='LU') +print "BE:" +print c.localizedomain(cc='BE') +``` ### Software Required * Python (tested successfully on version 2.6) * dnspython library - http://www.dnspython.org/ +* IPy library ### License