269 return WhoisIn(domain, text) |
269 return WhoisIn(domain, text) |
270 elif domain.endswith('.cat'): |
270 elif domain.endswith('.cat'): |
271 return WhoisCat(domain, text) |
271 return WhoisCat(domain, text) |
272 elif domain.endswith('.ie'): |
272 elif domain.endswith('.ie'): |
273 return WhoisIe(domain, text) |
273 return WhoisIe(domain, text) |
|
274 elif domain.endswith('.nz'): |
|
275 return WhoisNz(domain, text) |
274 else: |
276 else: |
275 return WhoisEntry(domain, text) |
277 return WhoisEntry(domain, text) |
276 |
278 |
277 |
279 |
278 class WhoisCom(WhoisEntry): |
280 class WhoisCom(WhoisEntry): |
1355 def __init__(self, domain, text): |
1357 def __init__(self, domain, text): |
1356 if 'no matching objects' in text: |
1358 if 'no matching objects' in text: |
1357 raise PywhoisError(text) |
1359 raise PywhoisError(text) |
1358 else: |
1360 else: |
1359 WhoisEntry.__init__(self, domain, text, self.regex) |
1361 WhoisEntry.__init__(self, domain, text, self.regex) |
|
1362 |
|
1363 |
|
1364 class WhoisNz(WhoisEntry): |
|
1365 """Whois parser for .nz domains |
|
1366 """ |
|
1367 regex = { |
|
1368 'domain_name': 'domain_name:\s*([^\n\r]+)', |
|
1369 'registrar': 'registrar_name:\s*([^\n\r]+)', |
|
1370 'updated_date': 'domain_datelastmodified:\s*([^\n\r]+)', |
|
1371 'creation_date': 'domain_dateregistered:\s*([^\n\r]+)', |
|
1372 'expiration_date': 'domain_datebilleduntil:\s*([^\n\r]+)', |
|
1373 'name_servers': 'ns_name_\d*:\s*([^\n\r]+)', # list of name servers |
|
1374 'status': 'status:\s*([^\n\r]+)', # list of statuses |
|
1375 'emails': EMAIL_REGEX, # list of email s |
|
1376 'name': 'registrant_contact_name:\s*([^\n\r]+)', |
|
1377 'address': 'registrant_contact_address\d*:\s*([^\n\r]+)', |
|
1378 'city': 'registrant_contact_city:\s*([^\n\r]+)', |
|
1379 'zipcode': 'registrant_contact_postalcode:\s*([^\n\r]+)', |
|
1380 'country': 'registrant_contact_country:\s*([^\n\r]+)', |
|
1381 } |
|
1382 |
|
1383 def __init__(self, domain, text): |
|
1384 if 'no matching objects' in text: |
|
1385 raise PywhoisError(text) |
|
1386 else: |
|
1387 WhoisEntry.__init__(self, domain, text, self.regex) |