For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
5 0 2 2

News Monitor Search =/= get_news_headlines()

Somehow I am not able to get the same results for News Monitor using the Python API. For example:

In News Monitor, my query is as follows:

R:PGA190 AND "summary" AND "regrade" AND "deals"

This returns relevant news records that match the search query.


However, in the Python API, I receive nothing in response to this query:

df = ek.get_news_headlines(query="R:PGA190 AND summary AND regrade AND deals")

I have also tried adding quote marks:

df = ek.get_news_headlines(query="R:PGA190 AND 'summary' AND 'regrade' AND 'deals'")


What might be my mistake here?

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
search.png (120.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvote
Accepted
18k 21 12 20

Hi @matthew.ang

You can use this code:

df = ek.get_news_headlines(query="R:PGA190 AND \\\"summary\\\" AND \\\"regrade\\\" AND \\\"deals\\\"")

Here is the output:


Well, you have to pass "summary" to API call which expect a JSON input.

So JSON-escaped text is \"summary\"

Then

\ escape charater in python is \\

" escape charater is \"

So \" becomes \\\" hence "summary" becomes \\\"summary\\\"


ahs.png (186.4 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Hi, it works perfect. Thank you very much!

Click below to post an Idea Post Idea