get data list from quote header 2
This commit is contained in:
@@ -159,10 +159,10 @@ 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-list = soup.find_all("span", class_="mod-ui-data-list__value")
|
data_list = soup.find_all("span", class_="mod-ui-data-list__value")
|
||||||
if data-list:
|
if data_list:
|
||||||
# get the quote price
|
# get the quote price
|
||||||
quote_price = float(data-list[0].text.replace(',',''))
|
quote_price = float(data_list[0].text.replace(',',''))
|
||||||
else:
|
else:
|
||||||
quote_price = 0.0
|
quote_price = 0.0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user