Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Eikon Data APIs /
avatar image
Question by kp123 · Aug 23, 2020 at 06:51 PM · eikondataapieikonerror error code 408 request timeout occuredget_news_headlineserrorcode408

Getting this error in Python Script: eikon.eikonError.EikonError: Error code 408 | Request timeout occured

I'm using the Eikon Data Api in a Python script that makes a get_news_headlines call every x minutes/hours. About 50% of the time I get this error: eikon.eikonError.EikonError: Error code 408 | Request timeout occured.

Looking for any ideas on how to fix this?

while True:
      try:
            headlines = ek.get_news_headlines(query='Language:LEN AND Source:RTRS',20,datetime.datetime.now().utcnow() - datetime.timedelta(minutes=x), datetime.datetime.now().utcnow())

            time.sleep(x)
          
      except (ek.EikonError):
      print("Error")
           

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

1 Reply

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by pierre.faurel · Aug 24, 2020 at 07:26 AM

Hi,

time.sleep() has a none visible effect: it's freezing all the thread, including the code that's sending the request and waiting for the response.

If you pause your code with time.sleep() function for a long time (more than several seconds), you shoudl replace with one another solution (x should be given in seconds):

from datetime import datetime, timedelta 
from threading import Event 
timer_event = Event() 

while True: 
    try: 
        headline = ek.get_news_headlines(query='Language:LEN AND Source:RTRS', count=20, date_from=datetime.now().utcnow() - timedelta(minutes=x), date_to=datetime.now().utcnow())
        timer_event.wait(timeout=x*60)
    except(ek.EikonError): 
        print("Error") 

or :

from datetime import datetime, timedelta 
import asyncio 

while True:
    try: 
        headline = ek.get_news_headlines(query='Language:LEN AND Source:RTRS',                                          count=20,                                          date_from=datetime.now().utcnow() - timedelta(minutes=x),                                          date_to=datetime.now().utcnow())
        asyncio.get_event_loop().run_until_complete(asyncio.sleep(x))
    except(ek.EikonError):
        print("Error")



Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
11 People are following this question.

Related Questions

Pulling TR.CLOSEPRICE weekly

Receiving "FutureWarning" when using "eikon.get_timeseries"

high , low, open , close for US forex session

How to add the document type filter condition in News Headline function?

Corporate actions adjustments: Event type = "Stock Dividend" missing from get_data() request

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges