lxml etree fromstring temukan

def xe_com_data(self, currencies):
  url = 'http://www.xe.com/currencytables/?from=%(currency_code)s&date=%(date)s'
  data = requests.request('GET', url % {'currency_code': 'INR', 'date': '2022-05-11'})
  result = {}
  available_currencies = currencies.mapped('name')
  html_content = etree.fromstring(data.content, etree.HTMLParser())
  table_rate = html_content.find(".//table[@class='currencytables__Table-xlq26m-3 jaGdii']/tbody")
  for table_entry in list(table_rate):
    code = table_entry.find('.//th/a')
    if code in available_currencies:
      print('test \n \n \n')
      rate = float(table_entry.find("td[3]").text)
      result[code] = (rate)
  return result
bilalahmed_dev