253 return WhoisIs(domain, text) |
253 return WhoisIs(domain, text) |
254 elif domain.endswith('.dk'): |
254 elif domain.endswith('.dk'): |
255 return WhoisDk(domain, text) |
255 return WhoisDk(domain, text) |
256 elif domain.endswith('.it'): |
256 elif domain.endswith('.it'): |
257 return WhoisIt(domain, text) |
257 return WhoisIt(domain, text) |
|
258 elif domain.endswith('.ai'): |
|
259 return WhoisAi(domain, text) |
258 else: |
260 else: |
259 return WhoisEntry(domain, text) |
261 return WhoisEntry(domain, text) |
260 |
262 |
261 |
263 |
262 class WhoisCom(WhoisEntry): |
264 class WhoisCom(WhoisEntry): |
1213 def __init__(self, domain, text): |
1215 def __init__(self, domain, text): |
1214 if 'No match for ' in text: |
1216 if 'No match for ' in text: |
1215 raise PywhoisError(text) |
1217 raise PywhoisError(text) |
1216 else: |
1218 else: |
1217 WhoisEntry.__init__(self, domain, text, self.regex) |
1219 WhoisEntry.__init__(self, domain, text, self.regex) |
|
1220 |
|
1221 class WhoisAi(WhoisEntry): |
|
1222 """Whois parser for .ai domains |
|
1223 """ |
|
1224 regex = { |
|
1225 'domain_name': 'Complete Domain Name\.*: *(.+)', |
|
1226 'name': 'Name \(Last, First\)\.*: *(.+)', |
|
1227 'org': 'Organization Name\.*: *(.+)', |
|
1228 'address': 'Street Address\.*: *(.+)', |
|
1229 'city': 'City\.*: *(.+)', |
|
1230 'state': 'State\.*: *(.+)', |
|
1231 'zipcode': 'Postal Code\.*: *(\d+)', |
|
1232 'country': 'Country\.*: *(.+)', |
|
1233 'name_servers': 'Server Hostname\.*: *(.+)', |
|
1234 } |
|
1235 |
|
1236 def __init__(self, domain, text): |
|
1237 if 'not registered' in text: |
|
1238 raise PywhoisError(text) |
|
1239 else: |
|
1240 WhoisEntry.__init__(self, domain, text, self.regex) |