whois/parser.py
branchwhois_in
changeset 137 565c0268bc39
parent 135 808c8bc803f5
child 138 f8c4b2f6355b
--- a/whois/parser.py	Sun Nov 26 01:04:03 2017 +0100
+++ b/whois/parser.py	Thu Nov 30 10:54:42 2017 +0100
@@ -263,6 +263,8 @@
             return WhoisAi(domain, text)
         elif domain.endswith('.il'):
             return WhoisIl(domain, text)
+        elif domain.endswith('.in'):
+            return WhoisIn(domain, text)
         else:
             return WhoisEntry(domain, text)
 
@@ -1274,3 +1276,23 @@
         if attr == 'emails':
             value = value.replace(' AT ', '@')
         return super(WhoisIl, self)._preprocess(attr, value)
+
+class WhoisIn(WhoisEntry):
+    """Whois parser for .in domains
+    """
+    regex = {
+        'domain_name':      'Domain Name: *(.+)',
+        'registrar':        'Registrar: *(.+)',
+        'updated_date':     'Last Updated On: *(.+)',
+        'creation_date':    'Created On: *(.+)',
+        'expiration_date':  'Expiration Date: *(.+)',
+        'name_servers':     'Name Server: *(.+)',
+        'status':           'Status: *(.+)',
+        'emails':           EMAIL_REGEX,
+    }
+
+    def __init__(self, domain, text):
+        if 'No entries found' in text:
+            raise PywhoisError(text)
+        else:
+            WhoisEntry.__init__(self, domain, text, self.regex)