HTTPError: 503 Service Unavailable: Trying to retrive news stories with Eikon Web and Scripting API

I am trying to retrieve news data with Eikon Web and Scripting API from Eikon Database.

The Headline retrieval works fine but if I try to get news texts I get the following:

     21 for index, headline_row in headlines_summary.iterrows():
---> 22 story = ek.get_news_story(headline_row['storyId'])
23 stories.append(story)
24 sleep(0.1)

C:\Anaconda3\lib\site-packages\eikon\news_request.py in get_news_story(story_id, raw_output, debug)
161 app_id = eikon.get_app_id()
162 payload = {'attributionCode': '', 'productName': app_id, 'storyId': story_id}
--> 163 json_data = eikon.json_requests.send_json_request(News_Story_UDF_endpoint, payload, debug=debug)
164
165 if raw_output:

C:\Anaconda3\lib\site-packages\eikon\json_requests.py in send_json_request(entity, payload, ID, debug)
80 if response.status_code == 200:
81 result = response.json()
---> 82 check_server_error(result)
83 return result
84 if response.status_code == 401:

C:\Anaconda3\lib\site-packages\eikon\json_requests.py in check_server_error(server_response)
128 else:
129 status_code = server_response['ErrorCode']
--> 130 raise requests.HTTPError(error_message, response=server_response)
131
132 # check DataGrid error

HTTPError: 503 Service Unavailable

I tried to put in some sleeptime. Without success.

Is there a known solution for my problem?

Thanks in advance.

Best Answer

  • Hi,

    By design, News Service doesn't provide more than 100 headlines per request. and raises "HTTPError: 503 Service Unavailable" if count > 100

Answers

  • can you retrieve one headline manually? for instance,

    html = tr.get_news_story('urn:newsml:reuters.com:20170524:nIFR1ZFCDP:1')

    if yes, how may headlines do you retrieve before 503? Could you print out the index variable during the loop.

  • also, could you please do

    print(ek.__version__)

    which version does it show?

  • Running into a similar issue here with Eikon package 0.1.9. This doesn't work:

    headlines = eikon.get_news_headlines('R:TRI.TO', count=3)
    for index, headline_row in headlines.iterrows():
    story = eikon.get_news_story(headline_row['storyId'])

    It produces the following error:

    KeyError: 'story'
  • Thanks for your fast reply.

    Version is:

    0.1.9

    I get 288 successful queries. Number 289 throws the error:

    HTTPError: 503 Service Unavailable
  • I get 288 successful queries. Number 289 throws the error.

  • Version: 0.1.9
  • @jakobyth, @Joris.Hoendervangers I have escalated this to the product management and will post here once the issue is identified.

    On a separate note, the API is not intended for the bulk news story retrieval. Do you have a viable use case? Leave the comments to this answer with your ideas.

  • The use case is to retrieve historical financial news on a certain topic and use them for sentiment analysis.

    I tried unsuccessfully to export news from the Eikon Client. Had also no success with the Eikon Excel Plug-in.

    Is there another way to get historical financial news?

  • While you can definitely use Eikon Scripting API for proof-of-concept work on low amounts of news articles, I suggest that you speak to your customer representative about either Thomson Reuters News Archive (TRNA) or Thomson Reuters Machine Readable News (MRN).