def get_tld_list():
 response_xml = salt.utils.namecheap.get_request(salt.utils.namecheap.get_opts('namecheap.domains.gettldlist'))
 if (response_xml is None):
  return []
 tldresult = response_xml.getElementsByTagName('Tlds')[0]
 tlds = []
 for e in tldresult.getElementsByTagName('Tld'):
  tld = salt.utils.namecheap.atts_to_dict(e)
  tld['data'] = e.firstChild.data
  categories = []
  subcategories = e.getElementsByTagName('Categories')[0]
  for c in subcategories.getElementsByTagName('TldCategory'):
   categories.append(salt.utils.namecheap.atts_to_dict(c))
  tld['categories'] = categories
  tlds.append(tld)
 return tlds

def get_tld_list ( ) : response_xml = salt . utils . namecheap . get_request ( salt . utils . namecheap . get_opts ( 'namecheap.domains.gettldlist' ) ) if ( response_xml is None ) : return [ ] tldresult = response_xml . getElementsByTagName ( 'Tlds' ) [ 0 ] tlds = [ ] for e in tldresult . getElementsByTagName ( 'Tld' ) : tld = salt . utils . namecheap . atts_to_dict ( e ) tld [ 'data' ] = e . firstChild . data categories = [ ] subcategories = e . getElementsByTagName ( 'Categories' ) [ 0 ] for c in subcategories . getElementsByTagName ( 'TldCategory' ) : categories . append ( salt . utils . namecheap . atts_to_dict ( c ) ) tld [ 'categories' ] = categories tlds . append ( tld ) return tlds
returns a list of tlds as objects cli example: .