Add .рф TLD expiration_date regex
authorEvgeni Kunev <evgeni.kunev@gmail.com>
Mon, 18 Aug 2014 11:36:24 +0300
changeset 37 8ad334b5363b
parent 36 af839b9c0ed1
child 38 da8f2956db7e
Add .рф TLD expiration_date regex
whois/parser.py
--- a/whois/parser.py	Mon Aug 18 11:25:39 2014 +0300
+++ b/whois/parser.py	Mon Aug 18 11:36:24 2014 +0300
@@ -1,3 +1,5 @@
+# coding=utf-8
+
 # parser.py - Module for parsing whois response data
 # Copyright (c) 2008 Andrey Petrov
 #
@@ -158,6 +160,8 @@
             return WhoisPt(domain, text)
         elif domain.endswith('.bg'):
             return WhoisBg(domain, text)
+        elif domain.endswith('.рф'):
+            return WhoisRf(domain, text)
         else:
             return WhoisEntry(domain, text)
 
@@ -619,3 +623,16 @@
             raise PywhoisError(text)
         else:
             WhoisEntry.__init__(self, domain, text, self.regex)
+
+class WhoisRf(WhoisEntry):
+    """Whois parser for .bg domains"""
+
+    regex = {
+        'expiration_date': 'free-date:\s*(.+)',
+    }
+
+    def __init__(self, domain, text):
+        if text.strip() == 'No entries found':
+            raise PywhoisError(text)
+        else:
+            WhoisEntry.__init__(self, domain, text, self.regex)