# HG changeset patch # User Richard Penman # Date 1394048733 18000 # Node ID 2d4e7d896236862847a1992e77d31213a6d2c0f1 # Parent 098d65e3cce7e7f448d19fb28b14183ab7ec2e08 added support for AU domain diff -r 098d65e3cce7 -r 2d4e7d896236 whois/parser.py --- a/whois/parser.py Wed Mar 05 14:36:45 2014 -0500 +++ b/whois/parser.py Wed Mar 05 14:45:33 2014 -0500 @@ -25,12 +25,14 @@ '%a %b %d %H:%M:%S %Z %Y', # Tue Jun 21 23:59:59 GMT 2011 '%Y-%m-%dT%H:%M:%SZ', # 2007-01-26T19:10:31Z '%Y-%m-%d %H:%M:%SZ', # 2000-08-22 18:55:20Z + '%Y-%m-%d %H:%M:%S', # 2000-08-22 18:55:20 '%d %b %Y %H:%M:%S', # 08 Apr 2013 05:44:00 ] for known_format in known_formats: try: - return datetime.strptime(s.strip(), known_format) + s = datetime.strptime(s.strip(), known_format) + break except ValueError as e: pass # Wrong format, keep trying return s @@ -112,6 +114,8 @@ return WhoisName(domain, text) elif domain.endswith('.me'): return WhoisMe(domain, text) + elif domain.endswith('.au'): + return WhoisAU(domain, text) elif domain.endswith('.ru'): return WhoisRu(domain, text) elif domain.endswith('.us'): @@ -461,6 +465,25 @@ else: WhoisEntry.__init__(self, domain, text, self.regex) + +class WhoisAU(WhoisEntry): + """Whois parser for .au domains + """ + regex = { + 'domain_name': 'Domain Name:\s*(.+)\n', + 'last_modified': 'Last Modified:\s*(.+)\n', + 'registrar': 'Registrar Name:\s*(.+)\n', + 'status': 'Status:\s*(.+)', + 'registrant_name': 'Registrant:\s*(.+)', + 'name_servers': 'Name Server:\s*(.+)', + } + def __init__(self, domain, text): + if text.strip() == 'No Data Found': + raise PywhoisError(text) + else: + WhoisEntry.__init__(self, domain, text, self.regex) + + class WhoisBr(WhoisEntry): """Whois parser for .br domains """