Python API access

Apologies, this is a basic question. I've been through the various tutorials/trial and error on accessing the API with no joy. I believe I may be close but it's not quite working. Any help/guidance much appreciated. Thank you. Rob
Background
I'm using LSEG workspace.
My Data API proxy is showing as Ready. Version 3.6.6. Localhost is 9001 (rather than 9000 which seems to be mentioned a lot).
I am using Python 3.10 with VSC and Jupyter.
What I've done
I have imported refinitiv.data successfully:
import refinitiv.data as rd
I have a version after having used an app_key:
rd.open_session()print(rd.__version__)
1.6.2
The app_key output is as follows which I think is in order but not totally sure.
# Initialize the session
rd.open_session( app_key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' )
<refinitiv.data.session.Definition object at 0x107b82c4250 {name='workspace'}>
The problem/error/issue
However, when I try to run something very basic it takes a while (c.45s then errors). So e.g.
df = rd.get_data(
universe = ['GB10YT=RR'],
fields = ['CF_CLOSE'])
display(df)
{
"name": "RDError",
"message": "Error code -1 | Cannot prepare connection OMMStreamConnection
\t\tname : ThreadOMMSTREAMING_PRICING_0.4
\t\tstate : StreamCxnState.Disposed
\t\tsubprotocol : tr_json2
\t\tis_auto_reconnect: True
\t\tcan_reconnect : False
\t\tnum_attempt : 0",
"stack": "---------------------------------------------------------------------------
RDError Traceback (most recent call last)
Cell In[10], line 1
----> 1 df = rd.get_data(
2 universe = ['GB10YT=RR'],
3 fields = ['CF_CLOSE']
4 )
6 display(df)
File ~\AppData\Roaming\Python\Python310\site-packages\refinitiv\data\_access_layer\get_data_func.py:126, in get_data(universe, fields, parameters, use_field_names_in_headers)
124 if exceptions and all(exceptions):
125 except_msg = "".join(exceptions)
--> 126 raise RDError(-1, except_msg)
128 hp_and_cust_inst_data = HPAndCustInstDataContainer(stream_columns, stream_data, stream_df)
129 adc_data = ADCDataContainer(adc_raw, adc_df, fields)
RDError: Error code -1 | Cannot prepare connection OMMStreamConnection
\t\tname : ThreadOMMSTREAMING_PRICING_0.4
\t\tstate : StreamCxnState.Disposed
\t\tsubprotocol : tr_json2
\t\tis_auto_reconnect: True
\t\tcan_reconnect : False
\t\tnum_attempt : 0"
}
Answers
-
Thank you for reaching out to us.
It seems that the library was unable to connect to the streaming server. It could be network or firewall issues.
You can enable the debug log in the library by using the following code before opening a session.
config = rd.get_config()
config.set_param("logs.transports.file.enabled", True)
config.set_param("logs.transports.file.name", "lseg-data-lib.log")
config.set_param("logs.level", "debug")Then, please share the lseg-data-lib.log file.
Moreover, you can contact the helpdesk team to verify what the problem is, as mentioned on this discussion.
0 -
Thanks for this. I'll take a look.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 556 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 652 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛