Exception from get bundle data in datastream
Hi,
Im using the Datastream get_bundle_data to returns several items for a universe of stocks. We have set up a loop to cycle our universe. It works fine,but then randomly we get an error and it says it has did connected. Can you please advise me on the following. I should not we are within the max requests and on retry it works.
1. How can we handle this so it avoids this disconnection. We currently have the program use tenacity retry, a wrapper from python but this is less than ideal. We want to avoid these errors all together.
2. Can we use multithreading to make this faster, we don't have this in place currently but would like to do it. Or any other optimisations you can recommend based on screenshots.
here is the exception:
on 40: HTTPSConnectionPool(host='product.datastream.com', port=443): Read timed out.
on 40: _get_json_Response: Exception Occured:
on 40: HTTPSConnectionPool(host='product.datastream.com', port=443):
Read timed out.
on 40: get_bundle_data: Exception Occured
on 40: (<class 'TypeError>, TypeError("argument of type 'None Type' is not
Iterable"), <traceback object at 0x00000227252BCC40>)
on 40: None
on 40: Traceback (most recent call last):
File "C:\Users\sayersqvm\miniconda3/envs/qvmLive\lib\site-
packages\DatastreamDSWS\DS_Response.py", line 209, in get_bundle_data
if 'DataResponses' in json_Response:
TypeError: argument of type 'None Type' is not iterable
on 62: ("Connection aborted.", RemoteDisconnected('Remote end closed connection without response"))
on 62: _get_json_Response: Exception Occured:
on 62: ('Connection aborted.", RemoteDisconnected('Remote end closed
connection without response'))
on 62: get_bundle_data: Exception Occured
on 62: (<class 'TypeError>, TypeError("argument of type 'None Type' is not
Iterable"), <traceback object at 0x0000022724802040>)
on 62: None
Reply
31
Search
Best Answer
-
I found that the default HTTP timeout of the DatastreamDSWS Python library is 180 seconds (3 minutes). Therefore, if you got an error after 3 minutes, it could relate to this setting.
You can change this timeout by using the configuration file (config.ini).
[app]
timeout=300
[url]
path=https://product.datastream.comThen, set this configuration file in the config parameter.
ds = DSWS.Datastream(username = username, password = password, config='config.ini')
However, if it doesn't solve the issue, it could be a connection or server issue.
Regarding using multiple threads with DatastreamDSWS, please refer to this article: Load Data using Multiprocessing in Python.
0
Answers
-
Hi @Blue.suit ,
Regarding an error you got, have you had a chance to check this thread?
The suggestion from the thread is you can use the requests Python library to check network settings. Please try the following code in the same environment and let us know the result
import requests
url = 'https://product.datastream.com/DSWSClient/V1/DSService.svc/rest/GetToken';
myobj = {"Password": "<username>",
"Properties": [{"Key": "__AppId", "Value": "PythonLib-1.1.0"}],
"UserName": "<password>"}
x = requests.post(url, json = myobj)
print(x.status_code)
print(x.text)You may need to enable HTTP logging in Python.
import logging
import http.client
http.client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = TrueHope this helps and please let me know in case you have any further questions
0 -
Sorry but this is not helpful. This example is not getting access at all. For our issue, we are able to get data, but it will intermittently freeze the call and result in an error. When it is retried, it works fine.
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛