whois/parser.py
changeset 134 3ff7f09ea24a
parent 132 7666f0765fe4
parent 133 29e9190319e5
child 135 808c8bc803f5
equal deleted inserted replaced
132:7666f0765fe4 134:3ff7f09ea24a
   254             return WhoisIs(domain, text)
   254             return WhoisIs(domain, text)
   255         elif domain.endswith('.dk'):
   255         elif domain.endswith('.dk'):
   256             return WhoisDk(domain, text)
   256             return WhoisDk(domain, text)
   257         elif domain.endswith('.it'):
   257         elif domain.endswith('.it'):
   258             return WhoisIt(domain, text)
   258             return WhoisIt(domain, text)
       
   259         elif domain.endswith('.ai'):
       
   260             return WhoisAi(domain, text)
   259         else:
   261         else:
   260             return WhoisEntry(domain, text)
   262             return WhoisEntry(domain, text)
   261 
   263 
   262 
   264 
   263 class WhoisCom(WhoisEntry):
   265 class WhoisCom(WhoisEntry):
  1214     def __init__(self, domain, text):
  1216     def __init__(self, domain, text):
  1215         if 'No match for ' in text:
  1217         if 'No match for ' in text:
  1216             raise PywhoisError(text)
  1218             raise PywhoisError(text)
  1217         else:
  1219         else:
  1218             WhoisEntry.__init__(self, domain, text, self.regex)
  1220             WhoisEntry.__init__(self, domain, text, self.regex)
       
  1221 
       
  1222 class WhoisAi(WhoisEntry):
       
  1223     """Whois parser for .ai domains
       
  1224     """
       
  1225     regex = {
       
  1226         'domain_name':      'Complete Domain Name\.*: *(.+)',
       
  1227         'name':             'Name \(Last, First\)\.*: *(.+)',
       
  1228         'org':              'Organization Name\.*: *(.+)',
       
  1229         'address':          'Street Address\.*: *(.+)',
       
  1230         'city':             'City\.*: *(.+)',
       
  1231         'state':            'State\.*: *(.+)',
       
  1232         'zipcode':          'Postal Code\.*: *(\d+)',
       
  1233         'country':          'Country\.*: *(.+)',
       
  1234         'name_servers':     'Server Hostname\.*: *(.+)',
       
  1235     }
       
  1236 
       
  1237     def __init__(self, domain, text):
       
  1238         if 'not registered' in text:
       
  1239             raise PywhoisError(text)
       
  1240         else:
       
  1241             WhoisEntry.__init__(self, domain, text, self.regex)