74 values = [] |
74 values = [] |
75 for value in re.findall(whois_regex, self.text, re.IGNORECASE): |
75 for value in re.findall(whois_regex, self.text, re.IGNORECASE): |
76 if isinstance(value, basestring): |
76 if isinstance(value, basestring): |
77 # try casting to date format |
77 # try casting to date format |
78 value = cast_date(value.strip()) |
78 value = cast_date(value.strip()) |
79 if value not in values: |
79 if value and value not in values: |
80 # avoid duplicates |
80 # avoid duplicates |
81 values.append(value) |
81 values.append(value) |
82 if len(values) == 1: |
82 if len(values) == 1: |
83 values = values[0] |
83 values = values[0] |
84 |
84 |
132 return WhoisJp(domain, text) |
132 return WhoisJp(domain, text) |
133 elif domain.endswith('.pl'): |
133 elif domain.endswith('.pl'): |
134 return WhoisPl(domain, text) |
134 return WhoisPl(domain, text) |
135 elif domain.endswith('.br'): |
135 elif domain.endswith('.br'): |
136 return WhoisBr(domain,text) |
136 return WhoisBr(domain,text) |
|
137 elif domain.endswith('.eu'): |
|
138 return WhoisEu(domain,text) |
137 elif domain.endswith('.kr'): |
139 elif domain.endswith('.kr'): |
138 return WhoisKr(domain,text) |
140 return WhoisKr(domain,text) |
139 else: |
141 else: |
140 return WhoisEntry(domain, text) |
142 return WhoisEntry(domain, text) |
141 |
143 |
486 raise PywhoisError(text) |
488 raise PywhoisError(text) |
487 else: |
489 else: |
488 WhoisEntry.__init__(self, domain, text, self.regex) |
490 WhoisEntry.__init__(self, domain, text, self.regex) |
489 |
491 |
490 |
492 |
|
493 class WhoisEu(WhoisEntry): |
|
494 """Whois parser for .eu domains |
|
495 """ |
|
496 regex = { |
|
497 'domain_name': r'Domain:\s*([^\n\r]+)', |
|
498 'tech_name': r'Technical:\s*Name:\s*([^\n\r]+)', |
|
499 'tech_org': r'Technical:\s*Name:\s*[^\n\r]+\s*Organisation:\s*([^\n\r]+)', |
|
500 'tech_phone': r'Technical:\s*Name:\s*[^\n\r]+\s*Organisation:\s*[^\n\r]+\s*Language:\s*[^\n\r]+\s*Phone:\s*([^\n\r]+)', |
|
501 'tech_fax': r'Technical:\s*Name:\s*[^\n\r]+\s*Organisation:\s*[^\n\r]+\s*Language:\s*[^\n\r]+\s*Phone:\s*[^\n\r]+\s*Fax:\s*([^\n\r]+)', |
|
502 'tech_email': r'Technical:\s*Name:\s*[^\n\r]+\s*Organisation:\s*[^\n\r]+\s*Language:\s*[^\n\r]+\s*Phone:\s*[^\n\r]+\s*Fax:\s*[^\n\r]+\s*Email:\s*([^\n\r]+)', |
|
503 'registrar': r'Registrar:\s*Name:\s*([^\n\r]+)', |
|
504 'name_servers': r'Name servers:\s*([^\n\r]+)\s*([^\n\r]*)\s*([^\n\r]*)\s*([^\n\r]*)\s*([^\n\r]*)\s*([^\n\r]*)\s*([^\n\r]*)\s*([^\n\r]*)\s*([^\n\r]*)\s*Keys', # list of name servers |
|
505 } |
|
506 |
|
507 def __init__(self, domain, text): |
|
508 if text.strip() == 'Status: AVAILABLE': |
|
509 raise PywhoisError(text) |
|
510 else: |
|
511 WhoisEntry.__init__(self, domain, text, self.regex) |
|
512 |
|
513 |
491 class WhoisBr(WhoisEntry): |
514 class WhoisBr(WhoisEntry): |
492 """Whois parser for .br domains |
515 """Whois parser for .br domains |
493 """ |
516 """ |
494 regex = { |
517 regex = { |
495 'domain': 'domain:\s*(.+)\n', |
518 'domain': 'domain:\s*(.+)\n', |