whois/parser.py
changeset 19 187df5b7a44a
parent 18 0181ec83a7e9
child 20 54fb35d6d1ae
equal deleted inserted replaced
18:0181ec83a7e9 19:187df5b7a44a
    19         '%d-%b-%Y', 				# 02-jan-2000
    19         '%d-%b-%Y', 				# 02-jan-2000
    20         '%Y-%m-%d', 				# 2000-01-02
    20         '%Y-%m-%d', 				# 2000-01-02
    21         '%d.%m.%Y', 				# 2.1.2000
    21         '%d.%m.%Y', 				# 2.1.2000
    22         '%Y.%m.%d',                 # 2000.01.02
    22         '%Y.%m.%d',                 # 2000.01.02
    23         '%Y/%m/%d',                 # 2000/01/02
    23         '%Y/%m/%d',                 # 2000/01/02
       
    24         '%Y. %m. %d.',              # 2000. 01. 02.
    24         '%Y.%m.%d %H:%M:%S',        # 2014.03.08 10:28:24
    25         '%Y.%m.%d %H:%M:%S',        # 2014.03.08 10:28:24
    25         '%d-%b-%Y %H:%M:%S %Z',		# 24-Jul-2009 13:20:03 UTC
    26         '%d-%b-%Y %H:%M:%S %Z',		# 24-Jul-2009 13:20:03 UTC
    26         '%a %b %d %H:%M:%S %Z %Y',  # Tue Jun 21 23:59:59 GMT 2011
    27         '%a %b %d %H:%M:%S %Z %Y',  # Tue Jun 21 23:59:59 GMT 2011
    27         '%Y-%m-%dT%H:%M:%SZ',       # 2007-01-26T19:10:31Z
    28         '%Y-%m-%dT%H:%M:%SZ',       # 2007-01-26T19:10:31Z
    28         '%Y-%m-%d %H:%M:%SZ',       # 2000-08-22 18:55:20Z
    29         '%Y-%m-%d %H:%M:%SZ',       # 2000-08-22 18:55:20Z
   131             return WhoisJp(domain, text)
   132             return WhoisJp(domain, text)
   132         elif domain.endswith('.pl'):
   133         elif domain.endswith('.pl'):
   133             return WhoisPl(domain, text)
   134             return WhoisPl(domain, text)
   134         elif domain.endswith('.br'):
   135         elif domain.endswith('.br'):
   135             return WhoisBr(domain,text)
   136             return WhoisBr(domain,text)
       
   137         elif domain.endswith('.kr'):
       
   138             return WhoisKr(domain,text)
   136         else:
   139         else:
   137             return WhoisEntry(domain, text)
   140             return WhoisEntry(domain, text)
   138 
   141 
   139 
   142 
   140 
   143 
   515        if 'Not found:' in text:
   518        if 'Not found:' in text:
   516            raise PywhoisError(text)
   519            raise PywhoisError(text)
   517        else:
   520        else:
   518            WhoisEntry.__init__(self, domain, text, self.regex)
   521            WhoisEntry.__init__(self, domain, text, self.regex)
   519 
   522 
       
   523 
       
   524 class WhoisKr(WhoisEntry):
       
   525     """Whois parser for .kr domains
       
   526     """
       
   527     regex = {
       
   528         'domain_name': 'Domain Name\s*:\s*(.+)',
       
   529         'registrant_org': 'Registrant\s*:\s*(.+)',
       
   530         'registrant_address': 'Registrant Address\s*:\s*(.+)',
       
   531         'registrant_zip': 'Registrant Zip Code\s*:\s*(.+)',
       
   532         'admin_name': 'Administrative Contact\(AC\)\s*:\s*(.+)',
       
   533         'admin_email': 'AC E-Mail\s*:\s*(.+)',
       
   534         'admin_phone': 'AC Phone Number\s*:\s*(.+)',
       
   535         'creation_date': 'Registered Date\s*:\s*(.+)',
       
   536         'updated_date':  'Last updated Date\s*:\s*(.+)',
       
   537         'expiration_date':  'Expiration Date\s*:\s*(.+)',
       
   538         'registrar':  'Authorized Agency\s*:\s*(.+)',
       
   539         'name_servers': 'Host Name\s*:\s*(.+)',  # list of name servers
       
   540     }
       
   541 
       
   542     def __init__(self, domain, text):
       
   543         if text.strip() == 'No entries found':
       
   544             raise PywhoisError(text)
       
   545         else:
       
   546             WhoisEntry.__init__(self, domain, text, self.regex)
       
   547 
       
   548