# HG changeset patch # User Evgeni Kunev # Date 1407759829 -10800 # Node ID e0b929723473f9c609b5bcb05c9bb902f428991c # Parent f3c0a9a442aa5872555fd370e2b7b1a6a0929053 Add expiry_date regex for .bg domains diff -r f3c0a9a442aa -r e0b929723473 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)