whois/parser.py
changeset 134 3ff7f09ea24a
parent 132 7666f0765fe4
parent 133 29e9190319e5
child 135 808c8bc803f5
--- a/whois/parser.py	Sun Aug 27 11:22:42 2017 -0300
+++ b/whois/parser.py	Thu Aug 31 22:10:29 2017 +0000
@@ -256,6 +256,8 @@
             return WhoisDk(domain, text)
         elif domain.endswith('.it'):
             return WhoisIt(domain, text)
+        elif domain.endswith('.ai'):
+            return WhoisAi(domain, text)
         else:
             return WhoisEntry(domain, text)
 
@@ -1216,3 +1218,24 @@
             raise PywhoisError(text)
         else:
             WhoisEntry.__init__(self, domain, text, self.regex)
+
+class WhoisAi(WhoisEntry):
+    """Whois parser for .ai domains
+    """
+    regex = {
+        'domain_name':      'Complete Domain Name\.*: *(.+)',
+        'name':             'Name \(Last, First\)\.*: *(.+)',
+        'org':              'Organization Name\.*: *(.+)',
+        'address':          'Street Address\.*: *(.+)',
+        'city':             'City\.*: *(.+)',
+        'state':            'State\.*: *(.+)',
+        'zipcode':          'Postal Code\.*: *(\d+)',
+        'country':          'Country\.*: *(.+)',
+        'name_servers':     'Server Hostname\.*: *(.+)',
+    }
+
+    def __init__(self, domain, text):
+        if 'not registered' in text:
+            raise PywhoisError(text)
+        else:
+            WhoisEntry.__init__(self, domain, text, self.regex)