Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
""" Private function used to return data from the FinViz screener. """
self._page_content, self._url = http_request_get('https://finviz.com/screener.ashx', payload={
'v': self._table,
't': ','.join(self._tickers),
'f': ','.join(self._filters),
'o': self._order,
's': self._signal,
'c': ','.join(self._custom)
})
self._rows = self.__check_rows()
self.headers = self.__get_table_headers()
page_urls = scrape.get_page_urls(self._page_content, self._rows, self._url)
async_connector = Connector(scrape.get_table,
page_urls,
self.headers,
self._rows)
pages_data = async_connector.run_connector()
data = []
for page in pages_data:
for row in page:
data.append(row)
return data
auth_response.raise_for_status()
# Get the parsed HTML and the URL of the base portfolio page
self._page_content, self.portfolio_url = http_request_get(url=PORTFOLIO_URL, session=self._session, parse=False)
# If the user has not created a portfolio it redirects the request to ?v=2)
if self.portfolio_url == f'{PORTFOLIO_URL}?v=2':
self.created = False
else:
self.created = True
if self.created:
if portfolio:
self._page_content, _ = self.__get_portfolio_url(portfolio)
self.data = get_table(self._page_content, PORTFOLIO_HEADERS)