Add expiry_date regex for .bg domains
authorEvgeni Kunev <evgeni.kunev@gmail.com>
Mon, 11 Aug 2014 15:23:49 +0300
changeset 26 e0b929723473
parent 25 f3c0a9a442aa
child 27 2afe979e4f4a
Add expiry_date regex for .bg domains
whois/parser.py
--- a/whois/parser.py	Fri Mar 21 12:09:00 2014 -0400
+++ b/whois/parser.py	Mon Aug 11 15:23:49 2014 +0300
@@ -31,6 +31,7 @@
         '%Y-%m-%d %H:%M:%SZ',       # 2000-08-22 18:55:20Z
         '%Y-%m-%d %H:%M:%S',        # 2000-08-22 18:55:20
         '%d %b %Y %H:%M:%S',        # 08 Apr 2013 05:44:00
+        '%d/%m/%Y %H:%M:%S.%f %Z',  # 23/04/2015 12:00:07.619546 EEST
     ]
 
     for known_format in known_formats:
@@ -153,6 +154,8 @@
             return WhoisKr(domain, text)
         elif domain.endswith('.pt'):
             return WhoisPt(domain, text)
+        elif domain.endswith('.bg'):
+            return WhoisBg(domain, text)
         else:
             return WhoisEntry(domain, text)
 
@@ -601,3 +604,16 @@
             raise PywhoisError(text)
         else:
             WhoisEntry.__init__(self, domain, text, self.regex)
+
+class WhoisBg(WhoisEntry):
+    """Whois parser for .bg domains"""
+
+    regex = {
+        'expiration_date': 'expires at:\s*(.+)',
+    }
+
+    def __init__(self, domain, text):
+        if text.strip() == 'No entries found':
+            raise PywhoisError(text)
+        else:
+            WhoisEntry.__init__(self, domain, text, self.regex)