Skip to content

Commit a71f52a

Browse files
committed
Changes for refinitiv-data.config.json file
Changes to explain how to open session using the 'official' json config file or alternative credentials store e.g. a .env file)
1 parent 05ca860 commit a71f52a

File tree

2 files changed

+59
-24
lines changed

2 files changed

+59
-24
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,4 @@ Configuration/refinitiv-data.config.json
133133
old/credentials.ipynb
134134
Configuration/refinitiv-data.config.json
135135
Configuration/refinitiv-data.config.json
136+
Configuration/refinitiv-data.config.json

Quick Start/1.0 - Sessions.ipynb

Lines changed: 58 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
"# Refinitiv Data Library for Python\n",
99
"## Define and Open a session\n",
1010
"\n",
11-
"Depending on the Credentials and Refinitiv Products/Services you have access to, you need define & open either a PlatformSession or DesktopSession: \n",
11+
"Depending on the Credentials and Refinitiv Products/Services you have access to, you need define & open either a Platform Session or Desktop Session: \n",
1212
"\n",
13-
" - **PlatformSession:** Used to connect to the Refinitiv Data Platform (RDP) directly or via a local (deployed) Real-time Distribution System(RTDS). The PlatformSession requires RDP credentials (machine account) or connection details of your local platform (IP of the local server and DACS user name).\n",
13+
" - **Platform Session:** Used to connect to the Refinitiv Data Platform (RDP) directly or via a local (deployed) Real-time Distribution System(RTDS). The PlatformSession requires RDP credentials (machine account) or connection details of your local platform (IP of the local server and DACS user name).\n",
1414
" - When the PlatformSession is used with RDP credentials only, it retrieves both streaming data and non-streaming data from the Refinitiv Data Platform.\n",
1515
" - When the PlatformSession is used with connection details of your local deployed platform, it retrieves streaming data only from your local platform. \n",
1616
" \n",
1717
" \n",
18-
" - **DesktopSession:** This type of session is used to connect RDP either via Eikon or via the Refinitiv Workspace. Eikon or the Refinitiv Workspace must be run **on the same PC** as your Python code.\n",
18+
" - **Desktop Session:** This type of session is used to connect RDP either via Eikon or via the Refinitiv Workspace. Eikon or the Refinitiv Workspace must be run **on the same PC** as your Python code.\n",
1919
" \n",
2020
"You will also require an App Key that uniquely identifies your application. Please refer to the Refinitiv Data Libraries Quick Start guide's **Access Credentials** section for instructions on creating an App Key."
2121
]
@@ -25,24 +25,26 @@
2525
"id": "c77f2e4c-c19f-4a6c-ac1e-31d1678a28b4",
2626
"metadata": {},
2727
"source": [
28-
"## Set the configuration file location\n",
29-
"For ease of use, we offer the option of setting various initialization parameters of the Refinitiv Data Library in the _refinitiv-data.config.json_ configuration file. \n",
28+
"## Set the location of the configuration file\n",
29+
"For ease of use, you can set various initialization parameters of the RD Library in the **_refinitiv-data.config.json_** configuration file - as detailed in the next section below.\n",
3030
"\n",
31-
"Typically you would place this file in the same folder as your Notebook or Python script.\n",
32-
"Alternatively, you can place the file in an alternative folder as specified using the _RD_LIB_CONFIG_PATH_ environment variable. \n",
31+
"Typically you may place this file in the same folder as your Notebook or Python script.\n",
32+
"Alternatively, you can place the file in an folder of your choice and specify the location using the _RD_LIB_CONFIG_PATH_ environment variable. \n",
3333
"\n",
34-
"As these tutorial Notebooks are in Categorised sub-folders and to avoid the need for multiple config files (in each folder), we will use the _RD_LIB_CONFIG_PATH_ environment variable to point to a single instance of the config file in the top-level ***Configuration*** folder."
34+
"As these tutorial Notebooks are in Categorised sub-folders and to avoid the need for multiple config files (in each sub-folder), we will use the _RD_LIB_CONFIG_PATH_ environment variable to point to a single instance of the config file in the top-level ***Configuration*** folder.\n",
35+
"\n",
36+
"Before proceeding, please **ensure you have entered your credentials** into the config file in the ***Configuration*** folder."
3537
]
3638
},
3739
{
3840
"cell_type": "code",
39-
"execution_count": 1,
41+
"execution_count": null,
4042
"id": "4c9f9a18-4960-43bf-aeeb-9a60ce748084",
4143
"metadata": {},
4244
"outputs": [],
4345
"source": [
4446
"import os\n",
45-
"os.environ[\"RD_LIB_CONFIG_PATH\"] = \"../../../Configuration\""
47+
"os.environ[\"RD_LIB_CONFIG_PATH\"] = \"../Configuration\""
4648
]
4749
},
4850
{
@@ -69,18 +71,21 @@
6971
"metadata": {},
7072
"source": [
7173
"## Using the 'refinitiv-data.config.json' file\n",
72-
"The Refinitiv data library config file has a default name of **'refinitiv-data.config.json'** allows you to specify session related parameters such as:\n",
73-
"* the default session to use\n",
74-
"* credentials\n",
75-
"* connectivity parameters \n",
76-
"\n",
77-
"for the various session types. \n",
74+
"Using the Refinitiv data library config file allows you to specify various parameters such as:\n",
75+
"* Default session\n",
76+
"* Credentials\n",
77+
"* Connectivity parameters \n",
78+
"* Logging related: \n",
79+
" - Enable or Disable console/file logging\n",
80+
" - Log Level\n",
81+
" - Filename\n",
7882
"\n",
7983
"### Easiest way to Create & Open a Session\n",
8084
"\n",
81-
"Using the config file, where possible, provides the simplest approach to creating and opening sessions. \n",
85+
"Using the above json config file, where possible, provides the simplest approach to creating and opening sessions. \n",
8286
"For example, assuming you have \n",
83-
"* a '*refinitiv-data.config.json*' in the current working directory \n",
87+
"* a '*refinitiv-data.config.json*' in the ***Configuration*** directory \n",
88+
"* **populated the file with your credentials**\n",
8489
"* and specified a 'default' session in the config file \n",
8590
"\n",
8691
"you can create and open the default session as follows:"
@@ -121,15 +126,15 @@
121126
"metadata": {},
122127
"outputs": [],
123128
"source": [
124-
"rd.open_session(name='platform.deployed')"
129+
"rd.open_session(name='platform.rdp')"
125130
]
126131
},
127132
{
128133
"cell_type": "markdown",
129134
"id": "6917355d-c1f3-4df8-a5d5-368e7dea0d02",
130135
"metadata": {},
131136
"source": [
132-
"The above would open a session based on the parameters specified in the '*\"platform.deployed\"* section of the json file."
137+
"The above would open a session based on the parameters specified in the '*\"platform.rdp\"* section of the json file."
133138
]
134139
},
135140
{
@@ -139,7 +144,7 @@
139144
"source": [
140145
"#### Open a session defined in a custom configuration file \n",
141146
"As well as the default config filename of **'refinitiv-data.config.json'**, you can also use a custom file to specify the config. \n",
142-
"The following call opens the default session as defined in your custom configuration file - with the filename passed as a parameter."
147+
"The following call opens the default session as defined in a custom configuration file - with the filename passed as a parameter."
143148
]
144149
},
145150
{
@@ -149,7 +154,7 @@
149154
"metadata": {},
150155
"outputs": [],
151156
"source": [
152-
"rd.open_session(config_name=\"../Configuration/refinitiv-data.config.json\")"
157+
"rd.open_session(config_name=\"../Configuration/refinitiv-data.custom.config.json\")"
153158
]
154159
},
155160
{
@@ -158,7 +163,7 @@
158163
"metadata": {},
159164
"source": [
160165
"<br> \n",
161-
"Alternatively, if you do not wish to use the refinitiv-data config file, you can define sessions by specifying the parameters and session type explicitly - as shown below.\n",
166+
"Alternatively, if you do not wish to use a refinitiv-data config file, you can define sessions by specifying the parameters and session type explicitly - as shown below.\n",
162167
"\n",
163168
"## Define the session using your own credentials store\n",
164169
"Sessions can be created by explicitly passing in your credentials/connectivity parameters.\n",
@@ -169,7 +174,7 @@
169174
{
170175
"cell_type": "code",
171176
"execution_count": null,
172-
"id": "af7ee821-4413-4754-9f38-c3a22725a962",
177+
"id": "3a5a7542-833e-421f-b5f3-a7d54701e169",
173178
"metadata": {},
174179
"outputs": [],
175180
"source": [
@@ -180,6 +185,35 @@
180185
"REALTIME_DISTRIBUTION_SERVICE_USER_NAME = 'YOUR_USER_NAME_ON_YOUR_RTDS_HOST' "
181186
]
182187
},
188+
{
189+
"cell_type": "markdown",
190+
"id": "3b0f1e3f-c16f-4618-87be-ee422b7a50e1",
191+
"metadata": {},
192+
"source": [
193+
"\n",
194+
"However, if you choose not use the refinitiv-data config file - rather than hardcoding parameters in your code, you may prefer to keep your credentials in a .env file (or some other external store) - to avoid accidentally exposing your credentials when sharing code. \n",
195+
"A empty .env file has been included in this ***Quick Start*** folder.\n"
196+
]
197+
},
198+
{
199+
"cell_type": "code",
200+
"execution_count": null,
201+
"id": "6685af34-58f9-4cff-85b6-c646a83a0595",
202+
"metadata": {},
203+
"outputs": [],
204+
"source": [
205+
"# OR \n",
206+
"# Load credentials from a .env file (+ override any OS system env vars of the same name)\n",
207+
"from dotenv import load_dotenv\n",
208+
"# change the path to the location of your .env file\n",
209+
"load_dotenv(dotenv_path='c:/Refinitiv/.env',override=True)\n",
210+
"APP_KEY = os.getenv('APP_KEY') # As created using the AppKey generator\n",
211+
"RDP_LOGIN = os.getenv('RDP_LOGIN') # e.g. 'GE-A-01234567-8-9101'\n",
212+
"RDP_PASSWORD = os.getenv('RDP_PASSWORD') # the long password set via the link in the Machine Account Welcome Email\n",
213+
"REALTIME_DISTRIBUTION_SERVICE_HOST = os.getenv('DEPLOYED_PLATFORM_HOST') # ADS hostname:PORT or IP:PORT e.g. 'myADS:15000'\n",
214+
"REALTIME_DISTRIBUTION_SERVICE_USER_NAME = os.getenv('DEPLOYED_PLATFORM_USER_NAME') # Your DACS User name"
215+
]
216+
},
183217
{
184218
"cell_type": "markdown",
185219
"id": "54ce2f53",

0 commit comments

Comments
 (0)