get data list from quote header

This commit is contained in:
2018-10-01 11:08:28 +02:00
parent 555ea3a32b
commit d02ecb4b17

View File

@@ -159,15 +159,12 @@ def getFTQuote(ticker):
# query & parse the html using beautiful soap and store in variable `soup` # query & parse the html using beautiful soap and store in variable `soup`
soup = BeautifulSoup(urllib2.urlopen(quote_page), 'html.parser') soup = BeautifulSoup(urllib2.urlopen(quote_page), 'html.parser')
data = [] data-list = soup.find_all("span", class_="mod-ui-data-list__value")
if data-list:
# get the quote price # get the quote price
rows = soup.findAll('table')[0].tbody.findAll('tr') quote_price = float(data-list[0].text.replace(',',''))
for each_row in rows: else:
divs = each_row.findAll('td') quote_price = 0.0
#I'm only interested in 'Close' price;
quote_price = float(divs[4].text.replace(',',''))
break
# retourne la prière ligne
return quote_price return quote_price