whois/parser.py
changeset 114 f3df17ee0909
parent 113 bb2f29951cbb
parent 112 8acab8765146
child 116 fff9472eb920
equal deleted inserted replaced
113:bb2f29951cbb 114:f3df17ee0909
   235             return WhoisMobi(domain, text)
   235             return WhoisMobi(domain, text)
   236         elif domain.endswith('.ch'):
   236         elif domain.endswith('.ch'):
   237             return WhoisChLi(domain, text)
   237             return WhoisChLi(domain, text)
   238         elif domain.endswith('.li'):
   238         elif domain.endswith('.li'):
   239             return WhoisChLi(domain, text)
   239             return WhoisChLi(domain, text)
       
   240         elif domain.endswith('.id'):
       
   241             return WhoisID(domain, text)
   240         else:
   242         else:
   241             return WhoisEntry(domain, text)
   243             return WhoisEntry(domain, text)
   242 
   244 
   243 
   245 
   244 class WhoisCom(WhoisEntry):
   246 class WhoisCom(WhoisEntry):
  1059     def __init__(self,domain,text):
  1061     def __init__(self,domain,text):
  1060         if 'We do not have an entry in our database matching your query.' in text:
  1062         if 'We do not have an entry in our database matching your query.' in text:
  1061             raise PywhoisError(text)
  1063             raise PywhoisError(text)
  1062         else:
  1064         else:
  1063             WhoisEntry.__init__(self, domain, text, self.regex)
  1065             WhoisEntry.__init__(self, domain, text, self.regex)
       
  1066 
       
  1067 class WhoisID(WhoisEntry):
       
  1068         """Whois parser for .id domains
       
  1069         """
       
  1070         regex = {
       
  1071             'domain_id':                   'Domain ID:(.+)',
       
  1072             'domain_name':                 'Domain Name:(.+)',
       
  1073             'creation_date':               'Domain Create Date:(.+)',
       
  1074             'updated_date':                'Domain Last Updated Date:(.+)',
       
  1075             'expiration_date':             'Domain Expiration Date:(.+)',
       
  1076             'transfer_date':               'Last Transferred Date:(.+)',
       
  1077             'trademark_name':              'Trademark Name:(.+)',
       
  1078             'trademark_country':           'Trademark Country:(.+)',
       
  1079             'trademark_number':            'Trademark Number:(.+)',
       
  1080             'trademark_application_date':  'Date Trademark Applied For:(.+)',
       
  1081             'trademark_registration_date': 'Date Trademark Registered:(.+)',
       
  1082             'registrar':                   'Sponsoring Registrar:(.+)',
       
  1083             'created_by':                  'Created by:(.+)',
       
  1084             'updated_by':                  'Last Updated by Registrar:(.+)',
       
  1085             'status':                      'Domain Status:(.+)',  # list of statuses
       
  1086             'registrant_id':               'Registrant ID:(.+)',
       
  1087             'registrant_name':             'Registrant Name:(.+)',
       
  1088             'registrant_org':              'Registrant Organization:(.+)',
       
  1089             'registrant_address':          'Registrant Address:(.+)',
       
  1090             'registrant_address2':         'Registrant Address2:(.+)',
       
  1091             'registrant_address3':         'Registrant Address3:(.+)',
       
  1092             'registrant_city':             'Registrant City:(.+)',
       
  1093             'registrant_state_province':   'Registrant State/Province:(.+)',
       
  1094             'registrant_country':          'Registrant Country/Economy:(.+)',
       
  1095             'registrant_postal_code':      'Registrant Postal Code:(.+)',
       
  1096             'registrant_phone':            'Registrant Phone:(.+)',
       
  1097             'registrant_phone_ext':        'Registrant Phone Ext\.:(.+)',
       
  1098             'registrant_fax':              'Registrant FAX:(.+)',
       
  1099             'registrant_fax_ext':          'Registrant FAX Ext\.:(.+)',
       
  1100             'registrant_email':            'Registrant E-mail:(.+)',
       
  1101             'admin_id':                    'Admin ID:(.+)',
       
  1102             'admin_name':                  'Admin Name:(.+)',
       
  1103             'admin_org':                   'Admin Organization:(.+)',
       
  1104             'admin_address':               'Admin Address:(.+)',
       
  1105             'admin_address2':              'Admin Address2:(.+)',
       
  1106             'admin_address3':              'Admin Address3:(.+)',
       
  1107             'admin_city':                  'Admin City:(.+)',
       
  1108             'admin_state_province':        'Admin State/Province:(.+)',
       
  1109             'admin_country':               'Admin Country/Economy:(.+)',
       
  1110             'admin_postal_code':           'Admin Postal Code:(.+)',
       
  1111             'admin_phone':                 'Admin Phone:(.+)',
       
  1112             'admin_phone_ext':             'Admin Phone Ext\.:(.+)',
       
  1113             'admin_fax':                   'Admin FAX:(.+)',
       
  1114             'admin_fax_ext':               'Admin FAX Ext\.:(.+)',
       
  1115             'admin_email':                 'Admin E-mail:(.+)',
       
  1116             'tech_id':                     'Tech ID:(.+)',
       
  1117             'tech_name':                   'Tech Name:(.+)',
       
  1118             'tech_org':                    'Tech Organization:(.+)',
       
  1119             'tech_address':                'Tech Address:(.+)',
       
  1120             'tech_address2':               'Tech Address2:(.+)',
       
  1121             'tech_address3':               'Tech Address3:(.+)',
       
  1122             'tech_city':                   'Tech City:(.+)',
       
  1123             'tech_state_province':         'Tech State/Province:(.+)',
       
  1124             'tech_country':                'Tech Country/Economy:(.+)',
       
  1125             'tech_postal_code':            'Tech Postal Code:(.+)',
       
  1126             'tech_phone':                  'Tech Phone:(.+)',
       
  1127             'tech_phone_ext':              'Tech Phone Ext\.:(.+)',
       
  1128             'tech_fax':                    'Tech FAX:(.+)',
       
  1129             'tech_fax_ext':                'Tech FAX Ext\.:(.+)',
       
  1130             'tech_email':                  'Tech E-mail:(.+)',
       
  1131             'name_servers':                'Nameservers:(.+)',  # list of name servers
       
  1132         }
       
  1133 
       
  1134         def __init__(self, domain, text):
       
  1135             if 'NOT FOUND' in text:
       
  1136                 raise PywhoisError(text)
       
  1137             else:
       
  1138                 WhoisEntry.__init__(self, domain, text, self.regex)