question

Upvotes
Accepted
21 1 3 5

An error occurred while requesting URL('http://localhost:9060/api/rdp/discovery/search/v1/'). ReadTimeout('timed out')

Currently struggling with obtaining data via the refinitiv.data API for Python, receiving the error message displayed in the title. The code, which worked until this morning looks like this:

import refinitiv.data as rd

rd.open_session()

data = rd.discovery.search(

view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,

top = 10000,

filter = "((DbType eq 'GOVT' or DbType eq 'CORP' or DbType eq 'AGNC' or DbType eq 'OMUN' or DbType eq 'OTHR') and RCSAssetCategory eq 'A:J' and IsActive eq true and (RCSBondGradeLeaf eq 'Investment Grade' or RCSBondGradeLeaf eq 'High Yield' or RCSBondGradeLeaf ne 'Investment Grade' and RCSBondGradeLeaf ne 'High Yield') and MaturityDate ge 2024-07-24 and (DenominationMinimum le 1000 and FaceOutstanding ge 100000000 and RCSCouponTypeGenealogy eq 'M:1EU\A:C1\A:25' and IsPrivatePlacement eq false and RCSCouponCurrencyLeaf xeq 'Euro' and IsExchangeListed eq true and RCSCurrencyLeaf eq 'Euro' and (SukukExchangeName xeq 'FRANKFURT STOCK EXCHANGE' or SukukExchangeName xeq 'STUTTGART STOCK EXCHANGE' or SukukExchangeName xeq 'MUNICH STOCK EXCHANGE' or SukukExchangeName xeq 'BERLIN STOCK EXCHANGE' or SukukExchangeName xeq 'DUSSELDORF STOCK EXCHANGE' or SukukExchangeName xeq 'TRADEGATE EXCHANGE' or SukukExchangeName xeq 'HAMBURG STOCK EXCHANGE' or SukukExchangeName xeq 'HANNOVER STOCK EXCHANGE' or SukukExchangeName xeq 'BORSA ITALIANA S.P.A.' or SukukExchangeName xeq 'LUXEMBOURG STOCK EXCHANGE' or SukukExchangeName xeq 'LONDON STOCK EXCHANGE PLC' or SukukExchangeName xeq 'WIENER BOERSE AG' or SukukExchangeName xeq 'EURONEXT PARIS' or SukukExchangeName xeq 'SIX SWISS EXCHANGE')))",

select = "DTSubjectName,MaturityDate,ISIN,DbTypeDescription"

)


(The eikon API and the respective app key were set as well for later on)

Any help would be greatly appreciated!

refinitiv-dataplatform-eikonerrortime-out
icon clock
10 |1500

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

Additional Info:

When trying to request data using the eikon API in Python I receive data without any problem.

My Refinitiv build looks like this:
1690358018182.png

1690358018182.png (40.6 KiB)
Upvotes
Accepted
21 1 3 5

Thank you for all your help! It does indeed seem to be some kind of network problem on my end.

icon clock
10 |1500

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

Upvotes
80.1k 257 52 75

@benedikt-luka.antic

Thank you for reaching out to us.

It may relate to the HTTP timeout. You can try to increase the timeout value in the RD library configuration file (refinitiv-data.config.json), as shown below. The sample refinitiv-data.config.json is available on GitHub.

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

Otherwise, you can change the timeout value by using the following code.

rd.get_config()["http.request-timeout"] = 60
icon clock
10 |1500

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

Upvotes
14.4k 30 5 10

Hi @benedikt-luka.antic ,

This seems to be related to the HTTP time out as Jirapongse answered in this question as below


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

Please let me know in case there's any further questions

icon clock
10 |1500

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

Upvotes
21 1 3 5

Thank you both for your answer! I have increased the http timeout as shown above (rd.get_config()["http.request-timeout"] = 60), however I still get the same error after a couple of seconds. I think it is related to 'httpx', since the timeout reads 'httpx.ReadTimeout: timed out'.

I tried to find a way to increase the or disable the timeout of httpx, but was not succesful.

Any help would be greatly appreciated!

icon clock
10 |1500

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

Upvotes
80.1k 257 52 75

@benedikt-luka.antic

Please try to set it before calling the open_session.

import refinitiv.data as rd
rd.get_config()["http.request-timeout"] = 60
rd.open_session()
data = rd.discovery.search(
    view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
    top = 10000,
    filter = "((DbType eq 'GOVT' or DbType eq 'CORP' or DbType eq 'AGNC' or DbType eq 'OMUN' or DbType eq 'OTHR') and RCSAssetCategory eq 'A:J' and IsActive eq true and (RCSBondGradeLeaf eq 'Investment Grade' or RCSBondGradeLeaf eq 'High Yield' or RCSBondGradeLeaf ne 'Investment Grade' and RCSBondGradeLeaf ne 'High Yield') and MaturityDate ge 2024-07-24 and (DenominationMinimum le 1000 and FaceOutstanding ge 100000000 and RCSCouponTypeGenealogy eq 'M:1EU\A:C1\A:25' and IsPrivatePlacement eq false and RCSCouponCurrencyLeaf xeq 'Euro' and IsExchangeListed eq true and RCSCurrencyLeaf eq 'Euro' and (SukukExchangeName xeq 'FRANKFURT STOCK EXCHANGE' or SukukExchangeName xeq 'STUTTGART STOCK EXCHANGE' or SukukExchangeName xeq 'MUNICH STOCK EXCHANGE' or SukukExchangeName xeq 'BERLIN STOCK EXCHANGE' or SukukExchangeName xeq 'DUSSELDORF STOCK EXCHANGE' or SukukExchangeName xeq 'TRADEGATE EXCHANGE' or SukukExchangeName xeq 'HAMBURG STOCK EXCHANGE' or SukukExchangeName xeq 'HANNOVER STOCK EXCHANGE' or SukukExchangeName xeq 'BORSA ITALIANA S.P.A.' or SukukExchangeName xeq 'LUXEMBOURG STOCK EXCHANGE' or SukukExchangeName xeq 'LONDON STOCK EXCHANGE PLC' or SukukExchangeName xeq 'WIENER BOERSE AG' or SukukExchangeName xeq 'EURONEXT PARIS' or SukukExchangeName xeq 'SIX SWISS EXCHANGE')))",
    select = "DTSubjectName,MaturityDate,ISIN,DbTypeDescription"
)
data

You may check the version of RD Library. I am using 1.3.0.

rd.__version__
icon clock
10 |1500

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

My mistake was not closing the session, so the timeout did not increase. Now, the timeout is increased, however now after waiting a while I receive the following error

httpx.RemoteProtocolError: Server disconnected without sending a response.

My version of the RD Library is 1.3.0 as well

@benedikt-luka.antic

It looks like to be a network issue.

Did you change anything on the application or system, such as python libraries or network settings?

You can enable logging in the API by using the following code.

import refinitiv.data as rd
rd.get_config()["http.request-timeout"] = 60
rd.get_config()["logs.level"] = "debug"
rd.get_config()["logs.transports.file.enabled"] = True
rd.get_config()["logs.transports.file.name"] = "refinitiv-data-lib.log"
rd.open_session()

The refinitiv-data-lib.log file will be created. We may be able to see unexpected behaviors in the log file.

I followed the steps outlined above twice, the second time setting

rd.get_config()["http.request-timeout"] = 300

The first time I received a timeout, the second time I received

httpx.RemoteProtocolError: Server disconnected without sending a response.

The log file is as follows: 20230727-1449-22656-refinitiv-data-lib.zip

I have not changed any network settings or libraries in the last two days (since this started happening) and I can still get data using the 'eikon' package in Python without any issue.

Show more comments
Upvotes
80.1k 257 52 75

@benedikt-luka.antic

Please run the following command in Powershell to verify the connection.

(Invoke-WebRequest -Method POST -Header (@{"Authorization"="bearer 124563";"x-tr-applicationid"="DEFAULT_WORKSPACE_APP_KEY"}) -Body (@{"View"="GovCorpInstruments";"Query"="IBM";"Select"="DTSubjectName,InstrumentTypeDescription";"Top"=10000}|ConvertTo-Json) -Uri http://localhost:9060/api/rdp/discovery/search/v1/ -ContentType application/json)

The output looks like this:

1690962153270.png


1690962153270.png (89.3 KiB)
icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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