Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

lxml etree fromstring find

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 
 
 
')
      rate = float(table_entry.find("td[3]").text)
      result[code] = (rate)
  return result
Comment

PREVIOUS NEXT
Code Example
Python :: corpus.fit(sentences, window=10) 
Python :: django assign authenticated user to foreign user 
Python :: Flask_SQLAlchemy is claiming my value is not boolean 
Python :: HTML default value fo radio button input type based on python variable 
Python :: How to correctly call url_for and specify path parameters 
Python :: Flask - how do I combine Flask-WTF and Flask-SQLAlchemy to edit db models 
Python :: singke line expresions python 
Python :: python while loop command gaming code 
Python :: find middle permutation of the string in python list 
Python :: for y in range(10): for x in range(y): print("*",end=') print() 
Python :: postgres fecth python 
Python :: ring Loop Command 
Python :: difflib get close matches 
Python :: ring Using the Natural Library 
Python :: gfxdraw circle weight 
Python :: python adx indicator 
Python :: get feature names from one hot encoder 
Python :: how to ge squrre root symobl as string inpython 
Python :: sympy.diff 
Python :: Print the multiple data types in a single program in list data structures 
Python :: print single pixel from numpy 
Python :: 2checkout ipn validation response python 
Python :: discord.py reply to message 
Python :: python multilevel list comprehension 
Python :: "How to get the remainder of a number when dividing in python" 
Python :: displays unique data including null data 
Python :: send command dynamo civid 
Python :: create graph, x y axis | graph plotting 
Python :: reminder application with notification in python 
Python :: smallest string with a given numeric value 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =