Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 0

No refinitiv.data attribute set_app_key

Hi,

The below instructions were given to me by one of your representatives. They said I should ask here for a resolution.

I’m on a Windows machine running Python 3.11 via Visual Studio Code. I have installed refinitiv-data and eikon via pip. Eikon is running in the background. Scripts are running in Codebook without a problem.

I have restarted both apps and the machine. Same error. Please advise on how to proceed. Thank you


Sample script:

---------------------------------------------------------------------------

import refinitiv.data as rd

import eikon as ek

import pandas as pd


rd.set_app_key('key……..')

rd.open_session()

rd.get_data(['LSEG.L', 'VOD.L'])

---------------------------------------------------------------------------


Error:

---------------------------------------------------------------------------

AttributeError Traceback (most recent call last)

c:\Users\acc_name\Coding\test\test1.py in line 5

2 import eikon as ek

3 import pandas as pd

----> 5 rd.set_app_key('key……..')

7 rd.open_session()

9 rd.get_data(['LSEG.L', 'VOD.L'])


File c:\Users\acc_name\AppData\Local\Programs\Python\Python311\Lib\site-packages\refinitiv\data\_tools\_lazy_loader.py:81, in attach.<locals>.__getattr__(name)

79 return attr

80 else:

---> 81 raise AttributeError(f"No {package_name} attribute {name}")


AttributeError: No refinitiv.data attribute set_app_key

---------------------------------------------------------------------------


#technology#productapi
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
76.7k 239 52 72

@A001

Thank you for reaching out to us.

The RD library doesn't have the set_app_key method.

Typically, you can use the RD library (import refinitiv.data as rd) or Eikon Data API (import eikon as ek), but not both because both libraries provide the similar functionalities.

I suggest to use only the RD library (import refinitiv.data as rd).

You can refer to the RD library examples on GitHub.

1. Download and unzip the examples

2. Modify the Configuration/refinitiv-data.config.json file by setting the default session to "desktop.workspace" and setting the application key

1697692582713.png

3. Run some examples


1697692582713.png (41.1 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 0 0 0

Thanks. I just did this. I put the config file in the same directory as the script.

Ran the following code and it generated an empty Dataframe:

----------------------------------------------------------

import refinitiv.data as rd

import pandas as pd

rd.open_session()

rd.get_data(['LSEG.L', 'VOD.L'])

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@A001

You can enable the debug log level to verify what the problem is.

config = rd.get_config()
config.set_param("logs.transports.console.enabled", True)
config.set_param("logs.level", "debug")
rd.open_session()
Upvotes
1 0 0 0

Code and log below. Log displays the correct app_key but have removed from below:


--------------------------------

import refinitiv.data as rd

import pandas as pd

rd.open_session()

rd.get_data(['LSEG.L', 'VOD.L'])

config = rd.get_config()

config.set_param("logs.transports.console.enabled", True)

config.set_param("logs.level", "debug")

rd.open_session()

--------------------------------


--------------------------------

[2023-10-19T14:06:28.339888+08:00] - [DEBUG] - [sessions.desktop.workspace.16] - [24980] | MainThread

DesktopSession created with following parameters: app_key="KEY_REDACT", name="workspace" base_url="http://localhost:9000" platform_path_rdp="/api/rdp" platform_path_udf="/api/udf" handshake_url="/api/handshake"

[2023-10-19T14:06:28.340885+08:00] - [DEBUG] - [sessions.desktop.workspace.16] - [24980] | MainThread

+ Session created: <refinitiv.data.session.Definition object at 0x24b5c3f8490 {name='workspace'}>

[2023-10-19T14:06:28.498467+08:00] - [DEBUG] - [sessions.desktop.workspace.17] - [24980] | MainThread

DesktopSession created with following parameters: app_key="KEY_REDACT", name="workspace" base_url="http://localhost:9000" platform_path_rdp="/api/rdp" platform_path_udf="/api/udf" handshake_url="/api/handshake"

[2023-10-19T14:06:28.498467+08:00] - [DEBUG] - [sessions.desktop.workspace.17] - [24980] | MainThread

+ Session created: <refinitiv.data.session.Definition object at 0x24b5c387850 {name='workspace'}>

--------------------------------

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
76.7k 239 52 72

@A001

The code should be like this:

import refinitiv.data as rd
import pandas as pd
config = rd.get_config()
config.set_param("logs.transports.console.enabled", True)
config.set_param("logs.level", "debug")
rd.open_session()
rd.get_data(['LSEG.L', 'VOD.L'])

You may not have permission to access those RICs. Please try the delayed RICs.

rd.get_data(['/LSEG.L', '/VOD.L'])
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.