--- a/whois/parser.py Thu Aug 24 15:52:15 2017 +0000
+++ b/whois/parser.py Tue Aug 29 23:09:05 2017 -0700
@@ -255,6 +255,8 @@
return WhoisDk(domain, text)
elif domain.endswith('.it'):
return WhoisIt(domain, text)
+ elif domain.endswith('.ai'):
+ return WhoisAi(domain, text)
else:
return WhoisEntry(domain, text)
@@ -1215,3 +1217,24 @@
raise PywhoisError(text)
else:
WhoisEntry.__init__(self, domain, text, self.regex)
+
+class WhoisAi(WhoisEntry):
+ """Whois parser for .ai domains
+ """
+ regex = {
+ 'domain_name': 'Complete Domain Name\.*: *(.+)',
+ 'name': 'Name \(Last, First\)\.*: *(.+)',
+ 'org': 'Organization Name\.*: *(.+)',
+ 'address': 'Street Address\.*: *(.+)',
+ 'city': 'City\.*: *(.+)',
+ 'state': 'State\.*: *(.+)',
+ 'zipcode': 'Postal Code\.*: *(\d+)',
+ 'country': 'Country\.*: *(.+)',
+ 'name_servers': 'Server Hostname\.*: *(.+)',
+ }
+
+ def __init__(self, domain, text):
+ if 'not registered' in text:
+ raise PywhoisError(text)
+ else:
+ WhoisEntry.__init__(self, domain, text, self.regex)