Trying to reproduce new issues in the news tutorial

Hello! I am trying to reproduce the tutorial from the Developer Website with no success:

https://developers.refinitiv.com/eikon-apis/eikon-data-api/learning?content=15351&type=learning_material_item

The code itself:

from datetime import date

start_date, end_date = date(2010, 1, 1), date.today()
q = "Product:IFREM AND Topic:ISU AND Topic:EUB AND (\"PRICED\" OR \"DEAL\")"
headlines = tr.get_news_headlines(query=q, date_from=start_date, date_to=end_date, count=100, raw_output=False)
headlines.head()

Error message:

2020-03-12 13:14:43,924 P[17328] [MainThread 13732] Backend error. Failed to deserialize backend response. Expected valid JSON. Error: invalid character 'i' looking for beginning of value

Could you please help?

Best Answer

  • umer.nalla
    Answer ✓

    Hi @alex.yermolayev

    I just tried the following as per the tutorial and it works Ok

    start_date, end_date = date(2010, 1, 1), date.today()
    q = "Product:IFREM AND Topic:ISU AND Topic:EUB AND (PRICED OR DEAL)"
    headlines = tr.get_news_headlines(query=q, date_from=start_date, date_to=end_date, count=100, raw_output=False)
    headlines.head()

    If I add the \" back in, then I get the same error as you do.


Answers

  • Many thanks, Umer @""

    I saw the error and corrected it. I downloaded the source code from the link on github, I guess the string formatting is not correct there.

  • Hi @alex.yermolayev

    Apologies for the problem and thanks for pointing out the differences on github. I have alerted the example owner.