# HG changeset patch # User richardpenman # Date 1521729988 14400 # Node ID 518764c4438cda97c352ad8291dd1ce7b1caf057 # Parent 6126b6d3e2ad32738bfc9d8bf372287b6f5c158c support for lu TLD diff -r 6126b6d3e2ad -r 518764c4438c whois/parser.py --- a/whois/parser.py Mon Mar 19 16:57:36 2018 -0400 +++ b/whois/parser.py Thu Mar 22 10:46:28 2018 -0400 @@ -276,6 +276,8 @@ return WhoisNz(domain, text) elif domain.endswith('.space'): return WhoisSpace(domain, text) + elif domain.endwith('.lu'): + return WhoisLu(domain, text) else: return WhoisEntry(domain, text) @@ -1398,3 +1400,39 @@ raise PywhoisError(text) else: WhoisEntry.__init__(self, domain, text, self.regex) + + +class WhoisLu(WhoisEntry): + """Whois parser for .lu domains + """ + regex = { + 'domain_name': 'domainname: *(.+)', + 'creation_date': 'registered: *(.+)', + 'name_servers': 'nserver: *(.+)', + 'status': 'domaintype: *(.+)', + 'registrar': 'registrar-name: *(.+)', + 'registrant_name': 'org-name: *(.+)', + 'registrant_address': 'org-address: *(.+)', + 'registrant_postal_code': 'org-zipcode:*(.+)', + 'registrant_city': 'org-city: *(.+)', + 'registrant_country': 'org-country: *(.+)', + 'admin_name': 'adm-name: *(.+)', + 'admin_address': 'adm-address: *(.+)', + 'admin_postal_code': 'adm-zipcode: *(.+)', + 'admin_city': 'adm-city: *(.+)', + 'admin_country': 'adm-country: *(.+)', + 'admin_email': 'adm-email: *(.+)', + 'tech_name': 'tec-name: *(.+)', + 'tech_address': 'tec-address: *(.+)', + 'tech_postal_code': 'tec-zipcode: *(.+)', + 'tech_city': 'tec-city: *(.+)', + 'tech_country': 'tec-country: *(.+)', + 'tech_email': 'tec-email: *(.+)', + } + + def __init__(self, domain, text): + if 'No such domain' in text: + raise PywhoisError(text) + else: + WhoisEntry.__init__(self, domain, text, self.regex) +