How to use get_news_headlines() querying for FDA?

In News Monitor I see that US FDA is tagged as "P:[U S Food and Drug Administration]". I'm trying to use this value into the query parameter of ek.get_news_headlines() but it doesn't seem to work. Any suggestions?

Tagged:

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @daniele.colombo21

    You can try 'P:[U S Food and Drug Administration]', as shown below.

    df = ek.get_news_headlines('P:[U S Food and Drug Administration]')

    The output is:

    1655260205726.png

    Currently, the get_news_headlines method can only get headlines from the News Wires source.

    If you would like to add double quotes to a query, you need to use the '\' characters, as shown below.

    news = ek.get_news_headlines('R:.SPX AND \\"TRUMP\\"')

    1655260735628.png


Answers

  • Hi @daniele.colombo21

    It will be helpful if you provide a screenshot of the News Monitor and what you are querying and an example of the get_news_headlines() API call you are using.


  • Thank you for your help. See below screenshot of News Monitor:

    1655241074823.png

    And another one when I click to expand the topic:

    1655241275447.png

    Finally an example query (I've tried various flavours though, with and without double quote escapes, square brackets, etc):

    ek.get_news_headlines(query='""P:[U S Food and Drug Administration]""', count=10)

    Which returns error


  • Thank you, for some reason yesterday this same query was returning an error, now it works fine.
  • Hi @daniele.colombo21

    If you use the strategic API (Refinitiv Data Library for Python), you can optionally access additional news sources. For example:

    import refinitiv.data as rd
    from refinitiv.data import eikon as ek

    ...

    # Default Source: News Wire
    ek.get_news_headlines(query='P:[U S Food and Drug Administration]')

    # News Room Source
    ek.get_news_headlines(query='P:[U S Food and Drug Administration]',
    repository='NewsRoom')

    # Web News Source
    ek.get_news_headlines(query='P:[U S Food and Drug Administration]',
    repository='WebNews')