Using get_data() on an API (Not Codebook)

I'm trying to switch on an API, but it seems like the codes i was using in the internal Refinitv codebook app (even simple lines like:
import refinitiv.data as rd
import refinitiv.data as rd
rd.open_session()
df = rd.get_data(
universe = ['AAPL.O'],
fields = ['CF_CLOSE']
)
display(df)
) don't seem to work in the API. Do you if the structure of the call changes in an API ?
Thank you !
Bests,
Victor
Answers
-
Thank you for reaching out to us.
You can enable the debug log in the API by using the following code in order to verify what the problem is.
import refinitiv.data as rd 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")
rd.open_session()
df = rd.get_data(
universe = ['AAPL.O'],
fields = ['CF_CLOSE']
)
display(df)With this code, the lseg-data-lib.log file will be created.
Please ensure all private information is removed from the file before sharing it
0 -
Hi Jirapongse,
Thank you for your reply.
Still not working :/
An error occurred while requesting URL('http://localhost:9000/api/status').ConnectError('[Errno 99] Cannot assign requested address')An error occurred while requesting URL('http://localhost:9060/api/status').ConnectError('[Errno 99] Cannot assign requested address')Error: no proxy address identified.Check if Desktop is running.An error occurred while requesting URL('http://localhost:9000/api/handshake').ConnectError('[Errno 99] Cannot assign requested address')Error on handshake url http://localhost:9000/api/handshake : ConnectError('[Errno 99] Cannot assign requested address')Session is not opened. Can't send any request
---------------------------------------------------------------------------ValueError Traceback (most recent call last)Cell In[25], line 14 9 config.set_param("logs.level", "debug") 12 rd.open_session()---> 14 df = rd.get_data( 15 16 universe = ['AAPL.O'], 17 18 fields = ['CF_CLOSE'] 19 20 ) 23 display(df)File /opt/conda/lib/python3.12/site-packages/refinitiv/data/_access_layer/get_data_func.py:63, in get_data(universe, fields, parameters, use_field_names_in_headers) 57 warnings.warn( 58 "Parameter 'use_field_names_in_headers' is deprecated and will be removed in future library version v2.0.", 59 FutureWarning, 60 ) 62 session = get_default()---> 63 raise_if_closed(session) 65 logger = session.logger() 67 # Library usage loggingFile /opt/conda/lib/python3.12/site-packages/refinitiv/data/_core/session/tools.py:37, in raise_if_closed(session) 35 error_message = "Session is not opened. Can't send any request" 36 session.error(error_message)---> 37 raise ValueError(error_message)ValueError: Session is not opened. Can't send any request
eventhough it workd for ds.get_data(tickers='NOVOb.CO', fields=(['TR.CommonName']))
0 -
It looks like that the library can't connect to the desktop session.
Please refer to the Eikon Data API and Refinitiv Data Library - Troubleshooting article to make sure that the Data API Proxy is running properly.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 37 Alpha
- 167 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 702 Datastream
- 1.5K DSS
- 633 Eikon COM
- 5.2K Eikon Data APIs
- 14 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 6 Trading API
- 2.9K Elektron
- 1.5K EMA
- 257 ETA
- 566 WebSocket API
- 40 FX Venues
- 16 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 283 Open PermID
- 47 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 24 RDMS
- 2.1K Refinitiv Data Platform
- 824 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
- 122 Open DACS
- 1.1K RFA
- 107 UPA
- 195 TREP Infrastructure
- 232 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 100 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛