The function below works fine except if it scans the page and finds the tag "fullview-news-outer" does not exists. This produces the error "list index out of range". How can I do a try catch to make sure tag "fullview-news-outer" exists and if it does not exit else set the table variable accordingly.
def get_news2(ticker):
"""
Returns a list of sets containing news headline and url
"""
page_parsed, _ = http_request_get(url=STOCK_URL, payload={'t': ticker}, parse=True)
table = page_parsed.cssselect('table[class="fullview-news-outer"]')[0]
...
return (df)