ReadError: [WinError 10054] An existing connection was forcibly closed by the remote host

Below is the code I am using. Anyone can help? Thank you.

*********************************
import refinitiv.data as rd
from refinitiv.data.content import search
rd.open_session()

response = search.Definition("AU000000BHP4 Berlin",top=1).get_data()
response.data.df.iloc[0][4]


rd.close_session()
************************************


Best Answer

  • @Liamli

    Thank you for reaching out to us.

    This is a Windows Sockets error code.

    WSAECONNRESET
    10054
    Connection reset by peer.
    An existing connection was forcibly closed by the remote host. This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, the host or remote network interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the SO_LINGER option on the remote socket). This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress. Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.

    It indicates that the server cut the connection.

    You can enable logging in the API to verify what the problem is. Add the following configuration to the RD configuration file (refinitiv-data.config.json).

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

        }
    ...
    }

    The refinitiv-data-lib.log file will created in the current directory.

    Please refer to the example on GitHub how to load the configuration file. For example:

    import os
    os.environ["RD_LIB_CONFIG_PATH"] = "../../Configuration"