to maintain stability

sgs
sgs Newcomer

I'm trying to retrieve the latest data, and it was working until yesterday. However, when I checked today, it stopped working. I have attempted some solutions, such as restarting and clearing the cache, but it is still unstable. Could you advise me on the best way to maintain stability?

import lseg.data as ld
config = ld.get_config()
config.set_param("logs.transports.console.enabled", True)
config.set_param("logs.level", "debug") ld.open_session()
df = ld.get_data(
universe=['0#LMESTX-LOC'],
fields=['GEN_TEXT16','PRIMACT_1']
)

[out]

[2025-01-30T09:34:11.051453+09:00] - [DEBUG] - [session] - [22940] | MainThread
Creating session "sessions.desktop.workspace.2" based on session.desktop.Definition("desktop.workspace")
[2025-01-30T09:34:11.053433+09:00] - [DEBUG] - [sessions.desktop.workspace.2] - [22940] | MainThread
DesktopSession created with following parameters: app_key="DEFAULT_WORKSPACE_APP_KEY", name="workspace" base_url="http://localhost:9000" platform_path_rdp="/api/rdp" platform_path_udf="/api/udf" handshake_url="/api/handshake"
[2025-01-30T09:34:11.053433+09:00] - [DEBUG] - [sessions.desktop.workspace.2] - [22940] | MainThread
Created session connection SessionCxnType.DESKTOP
[2025-01-30T09:34:11.054449+09:00] - [DEBUG] - [sessions.desktop.workspace.2] - [22940] | MainThread
Session created: DesktopSession
name = workspace
connection = DesktopConnection
stream_auto_reconnection = True
handshake_url = http://localhost:9000/api/handshake
state = OpenState.Closed
session_id = 2
logger_name = sessions.desktop.workspace.2
[2025-01-30T09:34:11.056422+09:00] - [DEBUG] - [sessions.desktop.workspace.0] - [22940] | MainThread
HTTP Request id 4
url = http://localhost:9060/api/udf
method = POST
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBcGlWZXJzaW9uIjoiMSIsIkFwcEtleSI6IjEyMDU0YjRlN2JiMTRlZTU4YWM2MzQ3MjQ4ZDMzNzg2MGY1MmUxZDUiLCJBcHBTY29wZSI6InRyYXBpIiwiTGlicmFyeU5hbWUiOiJSRFAgUHl0aG9uIExpYnJhcnkiLCJMaWJyYXJ5VmVyc2lvbiI6IjIuMC4xIiwiaWF0IjoxNzM4MTk3MTMyLCJleHAiOjE3Mzk0MDY3MzJ9.cnor2C3qX1MTjLkg6OZEGnJ5IpSzeHDO3Qv9eQS6bY8', 'x-tr-applicationid': 'DEFAULT_WORKSPACE_APP_KEY'}
json = {'Entity': {'E': 'DataGrid_StandardAsync', 'W': {'requests': [{'instruments': ['0#LMESTX-LOC'], 'fields': [{'name': 'GEN_TEXT16'}, {'name': 'PRIMACT_1'}]}]}}}
[2025-01-30T09:34:14.122476+09:00] - [DEBUG] - [sessions.desktop.workspace.0] - [22940] | MainThread
HTTP Response id 4
status_code = 200
text = {"ErrorCode":400,"ErrorMessage":"Backend error. 400 Bad Request"}

LDError Traceback (most recent call last)
Cell In[2], line 9
6 config.set_param("logs.level", "debug")
8 ld.open_session()
----> 9 df = ld.get_data(
10 universe=['0#LMESTX-LOC'],
11 fields=['GEN_TEXT16','PRIMACT_1']
12 )

LDError: Backend error. 400 Bad Request Requested universes: ['0#LMESTX-LOC']. Requested fields: ['GEN_TEXT16', 'PRIMACT_1']


Thank you in advance.

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @sgs

    Thank you for reaching out to us.

    According to the Eikon Data API Usage and Limits Guideline:

    When a request fails because the platform is overwhelmed, an HTTP response with status code 400 and the message "Backend error. 400 Bad Request" is returned. Then the Python library raises an EikonError exception with the following message:.

    error_bad_request.png

    The application may reduce the number of items in the request or implement try/except to catch this exception and then retry, as shown in this discussion.

Answers