whois/parser.py
branchwhois_in
changeset 137 565c0268bc39
parent 135 808c8bc803f5
child 138 f8c4b2f6355b
equal deleted inserted replaced
136:30259bf0523f 137:565c0268bc39
   261             return WhoisIt(domain, text)
   261             return WhoisIt(domain, text)
   262         elif domain.endswith('.ai'):
   262         elif domain.endswith('.ai'):
   263             return WhoisAi(domain, text)
   263             return WhoisAi(domain, text)
   264         elif domain.endswith('.il'):
   264         elif domain.endswith('.il'):
   265             return WhoisIl(domain, text)
   265             return WhoisIl(domain, text)
       
   266         elif domain.endswith('.in'):
       
   267             return WhoisIn(domain, text)
   266         else:
   268         else:
   267             return WhoisEntry(domain, text)
   269             return WhoisEntry(domain, text)
   268 
   270 
   269 
   271 
   270 class WhoisCom(WhoisEntry):
   272 class WhoisCom(WhoisEntry):
  1272 
  1274 
  1273     def _preprocess(self, attr, value):
  1275     def _preprocess(self, attr, value):
  1274         if attr == 'emails':
  1276         if attr == 'emails':
  1275             value = value.replace(' AT ', '@')
  1277             value = value.replace(' AT ', '@')
  1276         return super(WhoisIl, self)._preprocess(attr, value)
  1278         return super(WhoisIl, self)._preprocess(attr, value)
       
  1279 
       
  1280 class WhoisIn(WhoisEntry):
       
  1281     """Whois parser for .in domains
       
  1282     """
       
  1283     regex = {
       
  1284         'domain_name':      'Domain Name: *(.+)',
       
  1285         'registrar':        'Registrar: *(.+)',
       
  1286         'updated_date':     'Last Updated On: *(.+)',
       
  1287         'creation_date':    'Created On: *(.+)',
       
  1288         'expiration_date':  'Expiration Date: *(.+)',
       
  1289         'name_servers':     'Name Server: *(.+)',
       
  1290         'status':           'Status: *(.+)',
       
  1291         'emails':           EMAIL_REGEX,
       
  1292     }
       
  1293 
       
  1294     def __init__(self, domain, text):
       
  1295         if 'No entries found' in text:
       
  1296             raise PywhoisError(text)
       
  1297         else:
       
  1298             WhoisEntry.__init__(self, domain, text, self.regex)