lseg-data API

Hi, im trying to use lseg on Google Colab and I tried both EDP_API and EIKON_API… None worked here:
!pip install lseg.data
import lseg.data as ld
ld.open_session(app_key='edsf….fdss')
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')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')
<lseg.data.session.Definition object at 0x7a383f359350 {name='workspace'}>
ps: on pip install lseg.data, the output:
Collecting lseg.data Downloading lseg_data-2.1.1-py3-none-any.whl.metadata (10 kB)Collecting appdirs~=1.4.4 (from lseg.data) Downloading appdirs-1.4.4-py2.py3-none-any.whl.metadata (9.0 kB)Collecting pyee<=12,>=9.0.4 (from lseg.data) Downloading pyee-12.0.0-py3-none-any.whl.metadata (2.8 kB)Collecting httpx<0.28,>=0.18.0 (from lseg.data) Downloading httpx-0.27.2-py3-none-any.whl.metadata (7.1 kB)Requirement already satisfied: httpcore<1.1.0 in /usr/local/lib/python3.11/dist-packages (from lseg.data) (1.0.9)Requirement already satisfied: numpy in /usr/local/lib/python3.11/dist-packages (from lseg.data) (2.0.2)Requirement already satisfied: pandas<3.0,>=2.0 in /usr/local/lib/python3.11/dist-packages (from lseg.data) (2.2.2)Requirement already satisfied: python-dateutil in /usr/local/lib/python3.11/dist-packages (from lseg.data) (2.9.0.post0)Requirement already satisfied: requests in /usr/local/lib/python3.11/dist-packages (from lseg.data) (2.32.3)Requirement already satisfied: scipy in /usr/local/lib/python3.11/dist-packages (from lseg.data) (1.15.3)Requirement already satisfied: tenacity in /usr/local/lib/python3.11/dist-packages (from lseg.data) (9.1.2)Collecting watchdog (from lseg.data) Downloading watchdog-6.0.0-py3-none-manylinux2014_x86_64.whl.metadata (44 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.3/44.3 kB 1.9 MB/s eta 0:00:00Requirement already satisfied: websocket-client!=1.5.0,!=1.5.2,>=1.5 in /usr/local/lib/python3.11/dist-packages (from lseg.data) (1.8.0)Collecting pyhumps<4.0.0,>=3.0.2 (from lseg.data) Downloading pyhumps-3.8.0-py3-none-any.whl.metadata (4.0 kB)Requirement already satisfied: jinja2<4.0.0,>=3.0.3 in /usr/local/lib/python3.11/dist-packages (from lseg.data) (3.1.6)Requirement already satisfied: simplejson in /usr/local/lib/python3.11/dist-packages (from lseg.data) (3.20.1)Requirement already satisfied: certifi in /usr/local/lib/python3.11/dist-packages (from httpcore<1.1.0->lseg.data) (2025.4.26)Requirement already satisfied: h11>=0.16 in /usr/local/lib/python3.11/dist-packages (from httpcore<1.1.0->lseg.data) (0.16.0)Requirement already satisfied: anyio in /usr/local/lib/python3.11/dist-packages (from httpx<0.28,>=0.18.0->lseg.data) (4.9.0)Requirement already satisfied: idna in /usr/local/lib/python3.11/dist-packages (from httpx<0.28,>=0.18.0->lseg.data) (3.10)Requirement already satisfied: sniffio in /usr/local/lib/python3.11/dist-packages (from httpx<0.28,>=0.18.0->lseg.data) (1.3.1)Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.11/dist-packages (from jinja2<4.0.0,>=3.0.3->lseg.data) (3.0.2)Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.11/dist-packages (from pandas<3.0,>=2.0->lseg.data) (2025.2)Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.11/dist-packages (from pandas<3.0,>=2.0->lseg.data) (2025.2)Requirement already satisfied: typing-extensions in /usr/local/lib/python3.11/dist-packages (from pyee<=12,>=9.0.4->lseg.data) (4.13.2)Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil->lseg.data) (1.17.0)Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests->lseg.data) (3.4.2)Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests->lseg.data) (2.4.0)Downloading lseg_data-2.1.1-py3-none-any.whl (872 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 872.3/872.3 kB 16.2 MB/s eta 0:00:00Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)Downloading httpx-0.27.2-py3-none-any.whl (76 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 76.4/76.4 kB 6.3 MB/s eta 0:00:00Downloading pyee-12.0.0-py3-none-any.whl (14 kB)Downloading pyhumps-3.8.0-py3-none-any.whl (6.1 kB)Downloading watchdog-6.0.0-py3-none-manylinux2014_x86_64.whl (79 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.1/79.1 kB 6.2 MB/s eta 0:00:00Installing collected packages: pyhumps, appdirs, watchdog, pyee, httpx, lseg.data Attempting uninstall: httpx Found existing installation: httpx 0.28.1 Uninstalling httpx-0.28.1: Successfully uninstalled httpx-0.28.1ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.google-genai 1.14.0 requires httpx<1.0.0,>=0.28.1, but you have httpx 0.27.2 which is incompatible.
Successfully installed appdirs-1.4.4 httpx-0.27.2 lseg.data-2.1.1 pyee-12.0.0 pyhumps-3.8.0 watchdog-6.0.0
Answers
-
Thank you for reaching out to us.
Please check the answers on the following discussions.
- Connect EIKON to Google Colab
- If port 9000 is free and Data Proxy API is up, why isn't the app key working?
To use the library with the desktop session, the Workspace application is required to run on the same machine as a Python environment (Google Colab server). I am not sure if is possible to run the Workspace application which is a Windows application on the Colab server machine.
Otherwise, you need to use the platform.ldp session which requires the RDP's username, password, and application key.
"sessions": {
"default": "platform.ldp",
"platform": {
"ldp": {
"app-key": "YOUR APP KEY GOES HERE!",
"username": "YOUR LDP LOGIN OR MACHINE GOES HERE!",
"password": "YOUR LDP PASSWORD GOES HERE!"
},Or the code:
session = ld.session.platform.Definition(
app_key = APP_KEY,
grant = ld.session.platform.GrantPassword(
username = RDP_LOGIN,
password = RDP_PASSWORD
)
).get_session()The example is on GitHub.
0 -
It didnt work here. I tried both ways:
1)
sessions = { "default": "platform.ldp", "platform": { "ldp": { "app-key": os.environ['REFINITIV_EDP_API'], "username": os.environ['REFINITIV_USER'], "password": os.environ['REFINITIV_PASSWORD'] } }}
ld.open_session(sessions)---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/lseg/data/_configure.py in get_param(self, param) 302 try:--> 303 return self[param] 304 except KeyError:
7 frames
KeyError: "sessions.{'default': 'platform.ldp', 'platform': {'ldp': {'app-key': 'sdgs………bsd', 'username': 'zxv……………xvsv', 'password': 'bdsb………….fbbf'}}}"
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
AttributeError: Config object doesn't has 'sessions.{'default': 'platform.ldp', 'platform': 'ldp': {'app-key': 'sdgs………bsd', 'username': 'zxv……………xvsv', 'password': 'bdsb………….fbbf'}}' attribute
During handling of the above exception, another exception occurred:
NameError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/lseg/data/_access_layer/session.py in open_session(name, app_key, config_name) 52 except Exception: 53 config_name = f" {config_name}" if config_name else ""---> 54 raise NameError( 55 f"Cannot open session {name}\nThis session is not defined in the{config_name} configuration file" 56 )
NameError: Cannot open session {'default': 'platform.ldp', 'platform': {'ldp': {'app-key': 'sdgs………bsd', 'username': 'zxv……………xvsv', 'password': 'bdsb………….fbbf'}}}This session is not defined in the configuration file
2)session = ld.session.platform.Definition(
app_key = os.environ['REFINITIV_EDP_API'],
grant = ld.session.platform.GrantPassword(
username = os.environ['REFINITIV_USER'],
password = os.environ['REFINITIV_PASSWORD']
)
).get_session()ld.open_session(session)
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/lseg/data/_configure.py in get_param(self, param) 302 try:--> 303 return self[param] 304 except KeyError:
7 frames
KeyError: 'sessions.PlatformSession\n\t\tname = default\n\t\tconnection = PlatformDataConnection\n\t\tstream_auto_reconnection = True\n\t\tauthentication_token_endpoint_url = https://api.refinitiv.com/auth/oauth2/v1/token\n\t\tsignon_control = False\n\t\tserver_mode = False\n\t\tstate = OpenState.Closed\n\t\tsession_id = 9\n\t\tlogger_name = sessions.platform.default.9'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
AttributeError: Config object doesn't has 'sessions.PlatformSessionname = defaultconnection = PlatformDataConnectionstream_auto_reconnection = Trueauthentication_token_endpoint_url = https://api.refinitiv.com/auth/oauth2/v1/tokensignon_control = Falseserver_mode = Falsestate = OpenState.Closedsession_id = 9logger_name = sessions.platform.default.9' attribute
During handling of the above exception, another exception occurred:
NameError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/lseg/data/_access_layer/session.py in open_session(name, app_key, config_name) 52 except Exception: 53 config_name = f" {config_name}" if config_name else ""---> 54 raise NameError( 55 f"Cannot open session {name}\nThis session is not defined in the{config_name} configuration file" 56 )
NameError: Cannot open session PlatformSessionname = defaultconnection = PlatformDataConnectionstream_auto_reconnection = Trueauthentication_token_endpoint_url = https://api.refinitiv.com/auth/oauth2/v1/tokensignon_control = Falseserver_mode = Falsestate = OpenState.Closedsession_id = 9logger_name = sessions.platform.default.9This session is not defined in the configuration file
0 -
For the first method, you need to add it in the configuration file (lseg-data.config.json). Then, set the LD_LIB_CONFIG_PATH environment variable, as shown in the example.
import os
os.environ["LD_LIB_CONFIG_PATH"] = "../../Configuration"For the second method, the code looks like this:
session = ld.session.platform.Definition( app_key = APP_KEY, grant = ld.session.platform.GrantPassword( username = RDP_LOGIN, password = RDP_PASSWORD ), signon_control = True ).get_session() session.open() ld.session.set_default(session)
1 -
worked! thank you.
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 中文论坛