Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
5 3 4 3

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-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
search.png (120.3 KiB)
icon clock
10 |1500

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

1 Answer

· Write an Answer
Upvote
Accepted
18.2k 21 13 21

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 512.0 KiB each and 1.0 MiB total.

Hi, it works perfect. Thank you very much!

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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