whois/parser.py
changeset 125 43027d307ba4
parent 123 03c72d0d1182
child 126 f0f585979274
equal deleted inserted replaced
124:dfa8657bdefc 125:43027d307ba4
   249             return WhoisSe(domain, text)
   249             return WhoisSe(domain, text)
   250         elif domain.endswith('.nu'):
   250         elif domain.endswith('.nu'):
   251             return WhoisSe(domain, text)
   251             return WhoisSe(domain, text)
   252         elif domain.endswith('.is'):
   252         elif domain.endswith('.is'):
   253             return WhoisIs(domain, text)
   253             return WhoisIs(domain, text)
       
   254         elif domain.endswith('.dk'):
       
   255             return WhoisDk(domain, text)
   254         else:
   256         else:
   255             return WhoisEntry(domain, text)
   257             return WhoisEntry(domain, text)
   256 
   258 
   257 
   259 
   258 class WhoisCom(WhoisEntry):
   260 class WhoisCom(WhoisEntry):
  1180     def __init__(self, domain, text):
  1182     def __init__(self, domain, text):
  1181         if 'No entries found' in text:
  1183         if 'No entries found' in text:
  1182             raise PywhoisError(text)
  1184             raise PywhoisError(text)
  1183         else:
  1185         else:
  1184             WhoisEntry.__init__(self, domain, text, self.regex)
  1186             WhoisEntry.__init__(self, domain, text, self.regex)
       
  1187 
       
  1188 class WhoisDk(WhoisEntry):
       
  1189     """Whois parser for .dk domains
       
  1190     """
       
  1191     regex = {
       
  1192         'domain_name':     'Domain: *(.+)',
       
  1193         'creation_date':   'Registered: *(.+)',
       
  1194         'expiration_date': 'Expires: *(.+)',
       
  1195         'dnssec':          'Dnssec: *(.+)',
       
  1196         'status':          'Status: *(.+)',
       
  1197         'name_servers'     'Nameservers\n *([\n\S\s]+)'
       
  1198     }
       
  1199 
       
  1200     def __init__(self, domain, text):
       
  1201         if 'No match for ' in text:
       
  1202             raise PywhoisError(text)
       
  1203         else:
       
  1204             WhoisEntry.__init__(self, domain, text, self.regex)