# HG changeset patch # User Richard Baron Penman # Date 1357619255 -39600 # Node ID fd1bfb30b95e87522457bd3f47dc29ed843988cd # Parent c826e868bc63198f5b6764815e5456ac8f31706a applied French domain patch diff -r c826e868bc63 -r fd1bfb30b95e pywhois/parser.py --- a/pywhois/parser.py Tue Jan 08 15:21:34 2013 +1100 +++ b/pywhois/parser.py Tue Jan 08 15:27:35 2013 +1100 @@ -103,6 +103,8 @@ return WhoisMe(domain, text) elif '.uk' in domain: return WhoisUk(domain, text) + elif '.fr' in domain: + return WhoisFr(domain, text) elif '.fi' in domain: return WhoisFi(domain, text) else: @@ -119,6 +121,7 @@ else: WhoisEntry.__init__(self, domain, text) + class WhoisNet(WhoisEntry): """Whois parser for .net domains """ @@ -128,6 +131,7 @@ else: WhoisEntry.__init__(self, domain, text) + class WhoisOrg(WhoisEntry): """Whois parser for .org domains """ @@ -137,6 +141,7 @@ else: WhoisEntry.__init__(self, domain, text) + class WhoisRu(WhoisEntry): """Whois parser for .ru domains """ @@ -156,6 +161,7 @@ else: WhoisEntry.__init__(self, domain, text, self.regex) + class WhoisName(WhoisEntry): """Whois parser for .name domains """ @@ -180,7 +186,8 @@ raise PywhoisError(text) else: WhoisEntry.__init__(self, domain, text, self.regex) - + + class WhoisUs(WhoisEntry): """Whois parser for .us domains """ @@ -348,6 +355,28 @@ else: WhoisEntry.__init__(self, domain, text, self.regex) + +class WhoisFr(WhoisEntry): + """Whois parser for .fr domains + """ + regex = { + 'domain_name': 'domain:\s*(.+)', + 'registrar': 'registrar:\s*(.+)', + 'creation_date': 'created:\s*(.+)', + 'expiration_date': 'anniversary:\s*(.+)', + 'name_servers': 'nserver:\s*(.+)', # list of name servers + 'status': 'status:\s*(.+)', # list of statuses + 'emails': '[\w.-]+@[\w.-]+\.[\w]{2,4}', # list of email addresses + 'updated_date': 'last-update:\s*(.+)', + } + + def __init__(self, domain, text): + if text.strip() == 'No entries found': + raise PywhoisError(text) + else: + WhoisEntry.__init__(self, domain, text, self.regex) + + class WhoisFi(WhoisEntry): """Whois parser for .fi domains """