lit26 / finvizfinance

Finviz analysis python library.

Home Page:https://finvizfinance.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FINVIZFINANCE ISSUE WHEN GETTING TICKER INFO

opened this issue · comments

When I use:

from finvizfinance.quote import finvizfinance

stock = finvizfinance('tsla')
stock.ticker_fundament()

I get:

IndexError Traceback (most recent call last)
stock = finvizfinance('tsla')
stock.ticker_fundament()

in finvizfinance.ticker_fundament(self, raw, output_format)
134 rows = table.findAll("tr")
136 fundament_info["Company"] = rows[1].text
137 (
138 fundament_info["Sector"],
139 fundament_info["Industry"],
140 fundament_info["Country"],
--> 141 ) = rows[2].text.split(" | ")
143 fundament_table = self.soup.find("table", class_="snapshot-table2")
144 rows = fundament_table.findAll("tr")

IndexError: list index out of range

Any clue???

The website now have light and dark mode which show differently. I am currently looking into this.

Hi @lit26,

The indexing used here is wrong. Maybe it worked before but I made the function work by using the rows[0] and rows[1] index,

table = self.soup.find("table", class_="fullview-title")
rows = table.findAll("tr")

fundament_info["Company"] = rows[0].text
(
    fundament_info["Sector"],
    fundament_info["Industry"],
    fundament_info["Country"],
) = rows[1].text.split(" | ")

Thank you for creating and maintaining the project!

The issue is the same as #71 and #72. The fix is #73. I just need to double-check and fix other similar issues. Should be fixed soon.

Should be fixed in #73. Release in v0.14.6rc1. Thanks for reporting.