added support for .it domain
authorDoug Nelson <dougnelson@silktide.com>
Mon, 17 Jul 2017 12:07:49 +0100
changeset 129 ac57dd5a6b20
parent 128 a63883d0a695
child 130 342b440137ce
added support for .it domain
whois/parser.py
--- a/whois/parser.py	Tue May 30 08:03:53 2017 -0400
+++ b/whois/parser.py	Mon Jul 17 12:07:49 2017 +0100
@@ -253,6 +253,8 @@
             return WhoisIs(domain, text)
         elif domain.endswith('.dk'):
             return WhoisDk(domain, text)
+        elif domain.endswith('.it'):
+            return WhoisIt(domain, text)
         else:
             return WhoisEntry(domain, text)
 
@@ -1157,6 +1159,23 @@
         else:
             WhoisEntry.__init__(self, domain, text, self.regex)
 
+class WhoisIt(WhoisEntry):
+    """Whois parser for .it domains
+    """
+    regex = {
+        'domain_name':                    'Domain: *(.+)',
+        'creation_date':                  '(?<! )Created: *(.+)',
+        'updated_date':                   '(?<! )Last Update: *(.+)',
+        'expiration_date':                '(?<! )Expire Date: *(.+)',
+        'status':                         'Status: *(.+)',  # list of statuses
+    }
+
+    def __init__(self, domain, text):
+        if 'not found.' in text:
+            raise PywhoisError(text)
+        else:
+            WhoisEntry.__init__(self, domain, text, self.regex)
+
 
 class WhoisIs(WhoisEntry):
     """Whois parser for .se domains