Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table headers being empty causing data fetch error #188

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions finviz/screener.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,14 @@ def __check_rows(self):

def __get_table_headers(self):
""" Private function used to return table headers. """

return self._page_content.cssselect('tr[valign="middle"]')[0].xpath(
"td//text()"
)

# Original line to get headers
raw_headers = self._page_content.cssselect('tr[valign="middle"]')[0].xpath("td//text()")

# Clean headers by removing unwanted elements
clean_headers = [header.strip() for header in raw_headers if header.strip()]

return clean_headers

def __search_screener(self):
""" Private function used to return data from the FinViz screener. """
Expand Down