def get_news(symbol, info=None): """Returns news stories for a stock. :param symbol: The stock ticker. :type symbol: str :param info: Will filter the results to get a specific value. :type info: Optional[str] :returns: Returns a list of dictionaries. If info parameter is provided, \ a list of strings is returned where the strings are the value \ of the key that matches info. """ try: symbol = symbol.upper().strip() except AttributeError as message: print(message) return None url = urls.news(symbol) data = helper.request_get(url, 'results') return (helper.filter(data, info))
def get_news(symbol, info=None): """Returns news stories for a stock. :param symbol: The stock ticker. :type symbol: str :param info: Will filter the results to get a specific value. :type info: Optional[str] :returns: [list] Returns a list of dictionaries. If info parameter is provided, \ a list of strings is returned where the strings are the value \ of the key that matches info. :Dictionary Keys: * api_source * author * num_clicks * preview_image_url * published_at * relay_url * source * summary * title * updated_at * url * uuid * related_instruments * preview_text * currency_id """ try: symbol = symbol.upper().strip() except AttributeError as message: print(message, file=helper.get_output()) return None url = urls.news(symbol) data = helper.request_get(url, 'results') return (helper.filter(data, info))