ReadTimeout('The read operation timed out')

I want to get the constituents of the ETF IEUS.DE with this part of a Jupyter Notebook:

rd.open_session()
# Get constituents for ETF
response2 = fundamental_and_reference.Definition(
universe = "IEUS.DE",
fields = ["TR.ETPConstituentRIC,TR.ETPConstituentName"],
).get_data()

response2.data.df


I get the error

An error occurred while requesting URL('https://api.refinitiv.com/data/datagrid/beta1/').
    ReadTimeout('The read operation timed out')


When doing a similar request for STOXX with "TR.CommonName", everything works fine.

What should I do to avoid this error?



Welcome!

It looks like you're new here. Sign in or register to get started.

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @torben1

    Thank you for reaching out to us.

    You can try to increase the HTTP Request Timeout by changing its value in the Refinitiv Data Library configuration file (refinitiv-data.config.json).

    {
        "http": {        
            "request-timeout": 60        
    },

      "logs": {
        "level": "debug",
        "transports": {
          "console": {
            "enabled": false
          },
          "file": {
            "enabled": false,
            "name": "refinitiv-data-lib.log"
          }
        }
      },
      "sessions": {
        "default": "desktop.workspace",
    ...

    To load the configuration file, please refer to the example on GitHub.

    1688528194730.png

Answers

  • torben1
    torben1 Newcomer

    Thank You very much! I increased the request-timeout to 120 and now it works!


  • Anufriyev
    Anufriyev Explorer

    Dear @Jirapongse thank you for suggestion. I have the same problem. Is there a way to specify the request-timeout somewhere in the code as I don't use config file, but login like below?

    session = rd.session.platform.Definition(
                        app_key = os.environ['rdp_key_dev'], 
                        grant=rd.session.platform.GrantPassword(
                                    username=os.environ['rdp_username_dev'],
                                    password=os.environ['rdp_pass_dev']),
                        signon_control=True).get_session()
    session.open()
    rd.session.set_default(session)
  • Hi @Anufriyev

    You can config the timeout in code prior to opening the session:

    rd.get_config()["http.request-timeout"] = 120
  • Anufriyev
    Anufriyev Explorer

    Hi @nick.zincone Thank you for advice. That worked.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.