whois/parser.py
changeset 37 8ad334b5363b
parent 30 0ebff1cb6c75
child 39 68375a768598
equal deleted inserted replaced
36:af839b9c0ed1 37:8ad334b5363b
       
     1 # coding=utf-8
       
     2 
     1 # parser.py - Module for parsing whois response data
     3 # parser.py - Module for parsing whois response data
     2 # Copyright (c) 2008 Andrey Petrov
     4 # Copyright (c) 2008 Andrey Petrov
     3 #
     5 #
     4 # This module is part of pywhois and is released under
     6 # This module is part of pywhois and is released under
     5 # the MIT license: http://www.opensource.org/licenses/mit-license.php
     7 # the MIT license: http://www.opensource.org/licenses/mit-license.php
   156             return WhoisKr(domain, text)
   158             return WhoisKr(domain, text)
   157         elif domain.endswith('.pt'):
   159         elif domain.endswith('.pt'):
   158             return WhoisPt(domain, text)
   160             return WhoisPt(domain, text)
   159         elif domain.endswith('.bg'):
   161         elif domain.endswith('.bg'):
   160             return WhoisBg(domain, text)
   162             return WhoisBg(domain, text)
       
   163         elif domain.endswith('.рф'):
       
   164             return WhoisRf(domain, text)
   161         else:
   165         else:
   162             return WhoisEntry(domain, text)
   166             return WhoisEntry(domain, text)
   163 
   167 
   164 
   168 
   165 
   169 
   617     def __init__(self, domain, text):
   621     def __init__(self, domain, text):
   618         if text.strip() == 'No entries found':
   622         if text.strip() == 'No entries found':
   619             raise PywhoisError(text)
   623             raise PywhoisError(text)
   620         else:
   624         else:
   621             WhoisEntry.__init__(self, domain, text, self.regex)
   625             WhoisEntry.__init__(self, domain, text, self.regex)
       
   626 
       
   627 class WhoisRf(WhoisEntry):
       
   628     """Whois parser for .bg domains"""
       
   629 
       
   630     regex = {
       
   631         'expiration_date': 'free-date:\s*(.+)',
       
   632     }
       
   633 
       
   634     def __init__(self, domain, text):
       
   635         if text.strip() == 'No entries found':
       
   636             raise PywhoisError(text)
       
   637         else:
       
   638             WhoisEntry.__init__(self, domain, text, self.regex)