# HG changeset patch # User Evgeni Kunev # Date 1408350984 -10800 # Node ID 8ad334b5363b0863cc8aa8ce0e02672448b3bcfd # Parent af839b9c0ed1538844e118eb362bac16979c15dd Add .рф TLD expiration_date regex diff -r af839b9c0ed1 -r 8ad334b5363b 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)