Explict search in get_news_headlines does not work

Hi there, I am having issue using the eikon pythin api get_news_headlines function. As you can see in the enclosed screenshot. The plain query works fine. However, the explicit search syntax does not work for me anymore. I have used such syntax to query news headlines before, and not sure why it isn't working. Please help me investigate. I am using eikon package version '1.1.16', the query: query = "\"ESG report\" OR \"CSR report\" OR \"sustainability report\" OR \"climate report\"". The same query works on the terminal.

headline-error.png


Thanks in advance.

Best Answer

  • @DC

    Thanks for reaching out to us.

    The escape characters in the query are quite tricky. The query should look like this:

    df = ek.get_news_headlines(query="\\\"ESG report\\\" OR \\\"CSR report\\\" OR \\\"sustainability report\\\" OR \\\"climate report\\\"")
    df

    The output is:

    1675392342300.png

    I hope that this information is of help.

Answers