whois/parser.py
changeset 171 518764c4438c
parent 169 2a73627e8be7
child 172 68c0b9f2064f
equal deleted inserted replaced
170:6126b6d3e2ad 171:518764c4438c
   274             return WhoisIe(domain, text)
   274             return WhoisIe(domain, text)
   275         elif domain.endswith('.nz'):
   275         elif domain.endswith('.nz'):
   276             return WhoisNz(domain, text)
   276             return WhoisNz(domain, text)
   277         elif domain.endswith('.space'):
   277         elif domain.endswith('.space'):
   278             return WhoisSpace(domain, text)
   278             return WhoisSpace(domain, text)
       
   279         elif domain.endwith('.lu'):
       
   280             return WhoisLu(domain, text)
   279         else:
   281         else:
   280             return WhoisEntry(domain, text)
   282             return WhoisEntry(domain, text)
   281 
   283 
   282 
   284 
   283 class WhoisSpace(WhoisEntry):
   285 class WhoisSpace(WhoisEntry):
  1396     def __init__(self, domain, text):
  1398     def __init__(self, domain, text):
  1397         if 'no matching objects' in text:
  1399         if 'no matching objects' in text:
  1398             raise PywhoisError(text)
  1400             raise PywhoisError(text)
  1399         else:
  1401         else:
  1400             WhoisEntry.__init__(self, domain, text, self.regex)
  1402             WhoisEntry.__init__(self, domain, text, self.regex)
       
  1403 
       
  1404 
       
  1405 class WhoisLu(WhoisEntry):
       
  1406     """Whois parser for .lu domains
       
  1407     """
       
  1408     regex = {
       
  1409         'domain_name':              'domainname: *(.+)',
       
  1410         'creation_date':            'registered: *(.+)',
       
  1411         'name_servers':             'nserver: *(.+)',
       
  1412         'status':                   'domaintype: *(.+)',
       
  1413         'registrar':                'registrar-name: *(.+)',
       
  1414         'registrant_name':          'org-name: *(.+)',
       
  1415         'registrant_address':       'org-address: *(.+)',
       
  1416         'registrant_postal_code':   'org-zipcode:*(.+)',
       
  1417         'registrant_city':          'org-city: *(.+)',
       
  1418         'registrant_country':       'org-country: *(.+)',
       
  1419         'admin_name':               'adm-name: *(.+)',
       
  1420         'admin_address':            'adm-address: *(.+)',
       
  1421         'admin_postal_code':        'adm-zipcode: *(.+)',
       
  1422         'admin_city':               'adm-city: *(.+)',
       
  1423         'admin_country':            'adm-country: *(.+)',
       
  1424         'admin_email':              'adm-email: *(.+)',
       
  1425         'tech_name':                'tec-name: *(.+)',
       
  1426         'tech_address':             'tec-address: *(.+)',
       
  1427         'tech_postal_code':         'tec-zipcode: *(.+)',
       
  1428         'tech_city':                'tec-city: *(.+)',
       
  1429         'tech_country':             'tec-country: *(.+)',
       
  1430         'tech_email':               'tec-email: *(.+)',
       
  1431     }
       
  1432 
       
  1433     def __init__(self, domain, text):
       
  1434         if 'No such domain' in text:
       
  1435             raise PywhoisError(text)
       
  1436         else:
       
  1437             WhoisEntry.__init__(self, domain, text, self.regex)
       
  1438