applied French domain patch
authorRichard Baron Penman
Tue, 08 Jan 2013 15:27:35 +1100
changeset 4 fd1bfb30b95e
parent 3 c826e868bc63
child 5 7ace7955a131
applied French domain patch
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
     """