whois/parser.py
changeset 56 ff15b368adaf
parent 53 e2eaf1755fce
child 57 1f14b45214eb
equal deleted inserted replaced
55:bc23472ae284 56:ff15b368adaf
   711         else:
   711         else:
   712             WhoisEntry.__init__(self, domain, text, self.regex)
   712             WhoisEntry.__init__(self, domain, text, self.regex)
   713 
   713 
   714 
   714 
   715 class WhoisBg(WhoisEntry):
   715 class WhoisBg(WhoisEntry):
   716     """Whois parser for .bg domains"""
   716     """Whois parser for .bg domains
   717 
   717     """
   718     regex = {
   718     regex = {
   719         'expiration_date': 'expires at:\s*(.+)',
   719         'expiration_date': 'expires at:\s*(.+)',
   720     }
   720     }
   721 
   721 
   722     dayfirst = True
   722     dayfirst = True
   726             raise PywhoisError(text)
   726             raise PywhoisError(text)
   727         else:
   727         else:
   728             WhoisEntry.__init__(self, domain, text, self.regex)
   728             WhoisEntry.__init__(self, domain, text, self.regex)
   729 
   729 
   730 
   730 
   731 class WhoisRf(WhoisRu):
       
   732 
       
   733     """Whois parser for .rf domains
       
   734     """
       
   735     def __init__(self):
       
   736         super(WhoisRf, self).__init__()
       
   737 
       
   738 
       
   739 class WhoisDe(WhoisEntry):
   731 class WhoisDe(WhoisEntry):
   740     """Whois parser for .de domains"""
   732     """Whois parser for .de domains
   741 
   733     """
   742     regex = {
   734     regex = {
   743         'name': 'name:\s*(.+)',
   735         'name': 'name:\s*(.+)',
   744         'org': 'Organisation:\s*(.+)',
   736         'org': 'Organisation:\s*(.+)',
   745         'address': 'Address:\s*(.+)',
   737         'address': 'Address:\s*(.+)',
   746         'zipcode': 'PostalCode:\s*(.+)',
   738         'zipcode': 'PostalCode:\s*(.+)',
   756         else:
   748         else:
   757             WhoisEntry.__init__(self, domain, text, self.regex)
   749             WhoisEntry.__init__(self, domain, text, self.regex)
   758 
   750 
   759 
   751 
   760 class WhoisBe(WhoisEntry):
   752 class WhoisBe(WhoisEntry):
   761     """Whois parser for .be domains"""
   753     """Whois parser for .be domains
   762 
   754     """
   763     regex = {
   755     regex = {
   764         'name': 'Name:\s*(.+)',
   756         'name': 'Name:\s*(.+)',
   765         'org': 'Organisation:\s*(.+)',
   757         'org': 'Organisation:\s*(.+)',
   766         'phone': 'Phone:\s*(.+)',
   758         'phone': 'Phone:\s*(.+)',
   767         'fax': 'Fax:\s*(.+)',
   759         'fax': 'Fax:\s*(.+)',
   806             WhoisEntry.__init__(self, domain, text, self.regex)
   798             WhoisEntry.__init__(self, domain, text, self.regex)
   807 
   799 
   808 
   800 
   809 
   801 
   810 class WhoisSu(WhoisRu):
   802 class WhoisSu(WhoisRu):
   811 
       
   812     """Whois parser for .su domains
   803     """Whois parser for .su domains
   813     """
   804     """
   814     def __init__(self):
   805     def __init__(self, domain, text):
   815         super(WhoisSu, self).__init__()
   806         WhoisRu.__init__(self, domain, text)
   816 
   807 
   817 
   808 
   818 class WhoisClub(WhoisEntry):
   809 class WhoisClub(WhoisEntry):
   819 
       
   820     """Whois parser for .us domains
   810     """Whois parser for .us domains
   821     """
   811     """
   822     regex = {
   812     regex = {
   823         'domain_name':                    'Domain Name:\s*(.+)',
   813         'domain_name':                    'Domain Name:\s*(.+)',
   824         'domain__id':                     'Domain ID:\s*(.+)',
   814         'domain__id':                     'Domain ID:\s*(.+)',
   894         else:
   884         else:
   895             WhoisEntry.__init__(self, domain, text, self.regex)
   885             WhoisEntry.__init__(self, domain, text, self.regex)
   896 
   886 
   897 
   887 
   898 class WhoisIo(WhoisEntry):
   888 class WhoisIo(WhoisEntry):
   899 
   889     """Whois parser for .io domains
   900     """Whois parser for .io domains"""
   890     """
   901     regex = {
   891     regex = {
   902         'status':           'Status\s*:\s*(.+)',
   892         'status':           'Status\s*:\s*(.+)',
   903         'name_servers':     'NS \d?\s*:\s*(.+)',
   893         'name_servers':     'NS \d?\s*:\s*(.+)',
   904         'owner':            'Owner\s*:\s*(.+)',
   894         'owner':            'Owner\s*:\s*(.+)',
   905         'expiration_date':  'Expiry\s*:\s*(.+)',
   895         'expiration_date':  'Expiry\s*:\s*(.+)',
   912             raise PywhoisError(text)
   902             raise PywhoisError(text)
   913         else:
   903         else:
   914             WhoisEntry.__init__(self, domain, text, self.regex)
   904             WhoisEntry.__init__(self, domain, text, self.regex)
   915 
   905 
   916 
   906 
   917 class WhoisBiz(WhoisEntry):
   907 class WhoisBiz(WhoisUs):
   918 
   908     """Whois parser for .biz domains
   919     """Whois parser for .biz domains"""
   909     """
   920 
   910     def __init__(self, domain, text):
   921     def __init__(self, domain, text):
   911         WhoisUs.__init__(self, domain, text)
   922         super(WhoisUs, self).__init__(domain, text)
       
   923 
   912 
   924 
   913 
   925 class WhoisMobi(WhoisMe):
   914 class WhoisMobi(WhoisMe):
   926 
   915     """Whois parser for .mobi domains
   927     def __init__(self, domain, text):
   916     """
   928         super(WhoisMobi, self).__init__(domain, text)
   917     def __init__(self, domain, text):
       
   918         WhoisMe.__init__(self, domain, text)
   929 
   919 
   930 
   920 
   931 class WhoisKg(WhoisEntry):
   921 class WhoisKg(WhoisEntry):
       
   922     """Whois parser for .kg domains
       
   923     """
   932     regex = {
   924     regex = {
   933         'domain_name':                    'Domain\s*([\w]+\.[\w]{2,5})',
   925         'domain_name':                    'Domain\s*([\w]+\.[\w]{2,5})',
   934         'registrar':                      'Domain support: \s*(.+)',
   926         'registrar':                      'Domain support: \s*(.+)',
   935         'registrant_name':                'Name:\s*(.+)',
   927         'registrant_name':                'Name:\s*(.+)',
   936         'registrant_address1':            'Address:\s*(.+)',
   928         'registrant_address1':            'Address:\s*(.+)',
   947     def __init__(self, domain, text):
   939     def __init__(self, domain, text):
   948         if 'Data not found. This domain is available for registration' in text:
   940         if 'Data not found. This domain is available for registration' in text:
   949             raise PywhoisError(text)
   941             raise PywhoisError(text)
   950         else:
   942         else:
   951             WhoisEntry.__init__(self, domain, text, self.regex)
   943             WhoisEntry.__init__(self, domain, text, self.regex)
   952 
       
   953 
       
   954