hi there!
im trying to use the get_news_headlines function to pull out headlines for a list of entities.
The list if entities are saved on to a txt. file saved locally on my computer.
As an example, my txt file contains the name "SINGAPORE AEROSPACE MANUFACTURING PTE LTD". While running the get_news_headlines function, I pulled results for DAZN Pte Ltd. this occurs for other names as well. Please see search term on the right, along w the corresponding hits on the left.
Upon further investigation, my guess is that the search was not an exact search and hence threw out these items which I am not trying to get. Here is a screenshot of my search when manually performing the search via the News Monitor function on the app instead:My guess is that my code searches for the term and they are often automatically replaced by other keywords in eikon (i.e., if I do not include " " into my search then it is replaced by Singapore AND Aerospace AND MFLZ etc.).
I tried changing my code to update the search terms with " " to make it an exact match but it seems to generate a 503 error whenever the " " is added. My guess is that these quotation marks do not work well with the get_news_headlines function.
any work around this? some snippets of my code as well:
import eikon as ek import pandas as pd from datetime import datetime, timedel # Function to read search terms from a text file def read_search_terms(file_path): with open(file_path, 'r', encoding='utf-8') as file: return [line.strip() for line in file if line.strip()] # Function to get news headlines using Eikon Data API def get_news_headlines(query, date_from, date_to, count=5): headlines = ek.get_news_headlines(query=query, count=count, date_from=date_from, date_to=date_to) return headlines
any help is appreciated!