Refinitiv Data Library for Python

get_data

This method sends a request to the Refinitiv Data Platform to retrieve the data specified in the news.headlines.Definition object.

Module

refinitiv.data.content.news.headlines

Syntax

get_data(sesson, on_response, on_page_response)

Parameters

Value Description Data type Optional Default value
session Session object. If it's not passed the default session will be used. Session object Yes None
on_response User-defined callback function to process the final response containing all requested headlines. Callable Yes None
on_page_response User-defined callback function to process the intermediate responses for long lists of headlines returned page by page. Callable Yes None

Return value

news.headlines.Response

Usage

The following example demonstrates how to retrieve the last five news headlines from Google:

response = news.headlines.Definition(query="Google", count=5).get_data()

print(response.data.df.to_string())
> Response
versionCreated text storyId sourceCode
2022-09-20 05:16:30.884000 2022-09-20T05:16:30.884Z Appreciated chance to discuss Google's commitment to India: Sunder Pichai after visiting Indian Embassy urn:newsml:reuters.com:20220920:nNRAlxkksa:1 NS:MINTNE
2022-09-19 19:30:45.686000 2022-09-20T00:20:46.296Z Lincoln Aerospace Holdings, Inc. -- C urn:newsml:reuters.com:20220919:nEOL900vjZ:2 NS:EDG
2022-09-19 21:10:46.613000 2022-09-20T00:20:46.251Z Lincoln Aerospace Holdings, Inc. -- C/A urn:newsml:reuters.com:20220919:nEOLL9LPX:2 NS:EDG
2022-09-19 22:56:07.030000 2022-09-19T22:56:07.030Z Alphabet (GOOGL) Gains But Lags Market: What You Should Know urn:newsml:reuters.com:20220919:nNRAlxhdvn:1 NS:ZACKSC
2022-09-19 22:27:50 2022-09-19T22:27:50.000Z Google vai usar edifício de fundo do Pátria em SP urn:newsml:reuters.com:20220919:nL1N30Q2YY:1 NS:RTRS

The following example demonstrates how to retrieve the news headlines about Refinitiv for the last four days from 20.09.2022:

from datetime import timedelta

response = news.headlines.Definition(
    query="Refinitiv",
    date_from="20.09.2022",
    date_to=timedelta(days=-4),
    count=3
).get_data()

print(response.data.df.to_string())
> Response
versionCreated text storyId sourceCode
2022-09-14 02:34:50.827000 2022-09-19T23:57:03.763Z SERVICE ALERT - New Zealand Stock Exchange - INFORMATION see page urn:newsml:reuters.com:20220914:nVEN269079:15 NS:RFT
2022-08-30 16:30:23.300000 2022-09-19T23:51:57.959Z SERVICE ALERT - Hong Kong Futures Exchange - INFORMATION see page urn:newsml:reuters.com:20220830:nVEN256587:57 NS:RFT
2022-08-18 15:19:54.248000 2022-09-19T23:46:52.322Z SERVICE ALERT - PFTS Stock Exchange - INFORMATION see page urn:newsml:reuters.com:20220818:nVEN267524:92 NS:RFT

None