whois/parser.py
changeset 153 45bafc43d45d
parent 151 bcf90f7b9e12
child 155 08133c057eed
equal deleted inserted replaced
152:f614365ab91b 153:45bafc43d45d
   368             if len(lines) == 4:
   368             if len(lines) == 4:
   369                 self['zip_code'], _, self['city'] = lines[2].partition(' ')
   369                 self['zip_code'], _, self['city'] = lines[2].partition(' ')
   370             self['country'] = lines[-1]
   370             self['country'] = lines[-1]
   371 
   371 
   372 
   372 
   373 
       
   374 class WhoisName(WhoisEntry):
   373 class WhoisName(WhoisEntry):
   375     """Whois parser for .name domains
   374     """Whois parser for .name domains
   376     """
   375     """
   377     regex = {
   376     regex = {
   378         'domain_name_id':  'Domain Name ID: *(.+)',
   377         'domain_name_id':  'Domain Name ID: *(.+)',
   461         'tech_application_purpose':       'Technical Application Purpose: *(.+)',
   460         'tech_application_purpose':       'Technical Application Purpose: *(.+)',
   462         'tech_nexus_category':            'Technical Nexus Category: *(.+)',
   461         'tech_nexus_category':            'Technical Nexus Category: *(.+)',
   463         'name_servers':                   'Name Server: *(.+)',  # list of name servers
   462         'name_servers':                   'Name Server: *(.+)',  # list of name servers
   464         'created_by_registrar':           'Created by Registrar: *(.+)',
   463         'created_by_registrar':           'Created by Registrar: *(.+)',
   465         'last_updated_by_registrar':      'Last Updated by Registrar: *(.+)',
   464         'last_updated_by_registrar':      'Last Updated by Registrar: *(.+)',
   466         'creation_date':                  'Domain Registration Date: *(.+)',
   465         'creation_date':                  'Creation Date: *(.+)',
   467         'expiration_date':                'Domain Expiration Date: *(.+)',
   466         'expiration_date':                'Registry Expiry Date: *(.+)',
   468         'updated_date':                   'Domain Last Updated Date: *(.+)',
   467         'updated_date':                   'Updated Date: *(.+)',
   469     }
   468     }
   470 
   469 
   471     def __init__(self, domain, text):
   470     def __init__(self, domain, text):
   472         if 'Not found:' in text:
   471         if 'Not found:' in text:
   473             raise PywhoisError(text)
   472             raise PywhoisError(text)
  1324     def __init__(self, domain, text):
  1323     def __init__(self, domain, text):
  1325         if 'no matching objects' in text:
  1324         if 'no matching objects' in text:
  1326             raise PywhoisError(text)
  1325             raise PywhoisError(text)
  1327         else:
  1326         else:
  1328             # Merge base class regex with specifics
  1327             # Merge base class regex with specifics
  1329             self._regex.update(self.regex)
  1328             self._regex.copy().update(self.regex)
  1330             self.regex = self._regex
  1329             self.regex = self._regex
  1331             WhoisEntry.__init__(self, domain, text, self.regex)
  1330             WhoisEntry.__init__(self, domain, text, self.regex)