Skip to content

Commit 27e8003

Browse files
committed
refinitiv-data.config.json references
Add refinitiv-data.config.json changes
1 parent f118e83 commit 27e8003

File tree

1 file changed

+105
-59
lines changed

1 file changed

+105
-59
lines changed

1. Quick Start/1.0 - Sessions.ipynb

Lines changed: 105 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@
2525
"id": "560d68d9",
2626
"metadata": {},
2727
"source": [
28-
"## Import the library and load credentials\n",
29-
"\n",
30-
"Credentials used by this and the other tutorials notebooks are stored in the **Configuration//credentials.ipynb** file. \n",
31-
"\n",
32-
"Please edit **Configuration/credentials.ipynb** to set your credentials and run the next cell to continue"
28+
"## Import the library"
3329
]
3430
},
3531
{
@@ -39,17 +35,113 @@
3935
"metadata": {},
4036
"outputs": [],
4137
"source": [
42-
"import refinitiv.data as rd\n",
38+
"import refinitiv.data as rd"
39+
]
40+
},
41+
{
42+
"cell_type": "markdown",
43+
"id": "ab5d158c-c9db-4c70-a40e-69f3fe0a27bd",
44+
"metadata": {},
45+
"source": [
46+
"## Using the 'refinitiv-data.config.json' file\n",
47+
"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",
48+
"* the default session to use\n",
49+
"* credentials\n",
50+
"* connectivity parameters \n",
4351
"\n",
44-
"%run ../Configuration/credentials.ipynb"
52+
"for the various session types. \n",
53+
"Using the config file, where possible, provides the simplest approach to creating and opening sessions. \n",
54+
"For example, assuming you have specified a 'default' session in the config file, you can create and open the default session as follows:"
55+
]
56+
},
57+
{
58+
"cell_type": "code",
59+
"execution_count": null,
60+
"id": "94f821ff-a3ae-4a02-bf4d-c737ce581b07",
61+
"metadata": {},
62+
"outputs": [],
63+
"source": [
64+
"rd.open_session()"
65+
]
66+
},
67+
{
68+
"cell_type": "markdown",
69+
"id": "dbed0e57-0625-4561-a559-dcfc28b7d722",
70+
"metadata": {},
71+
"source": [
72+
"The above will look for an entry such as: \n",
73+
"> *\"sessions\": { \n",
74+
"> \"default\": \"desktop.default\", \n",
75+
"> .... \n",
76+
"> }* \n",
77+
"\n",
78+
"and then use the parameters defined in the config section - in this example *\"desktop.default\"*, to create and open a desktop session. \n",
79+
"Please refer to the supplied example **'refinitiv-data.config.json'** file for the full config example.\n",
80+
"\n",
81+
"### Open a specific configured session\n",
82+
"If you have multiple sessions configurations specified in the json file you can open a specific one by name e.g.:"
83+
]
84+
},
85+
{
86+
"cell_type": "code",
87+
"execution_count": null,
88+
"id": "693ee487-c6d0-4449-83b8-d206b4654867",
89+
"metadata": {},
90+
"outputs": [],
91+
"source": [
92+
"rd.open_session(name = 'platform.deployed')"
93+
]
94+
},
95+
{
96+
"cell_type": "markdown",
97+
"id": "6917355d-c1f3-4df8-a5d5-368e7dea0d02",
98+
"metadata": {},
99+
"source": [
100+
"The above would open a session based on the parameters specified in the '*\"platform.deployed\"* section of the json file."
101+
]
102+
},
103+
{
104+
"cell_type": "markdown",
105+
"id": "583edf78-f57e-4193-9681-2d0f0c7af4e7",
106+
"metadata": {},
107+
"source": [
108+
"#### Open a session defined in a custom configuration file \n",
109+
"As well as the default config filename of **'refinitiv-data.config.json'**, you can also use a custom file to specify the config. \n",
110+
"The following call opens the default session as defined in your custom configuration file - with the filename passed as a parameter."
111+
]
112+
},
113+
{
114+
"cell_type": "code",
115+
"execution_count": null,
116+
"id": "4553a5cd-4bfc-46db-ac26-e07a92d8336b",
117+
"metadata": {},
118+
"outputs": [],
119+
"source": [
120+
"rd.open_session(config_name=\"refinitiv-data.custom.config.json\")"
45121
]
46122
},
47123
{
48124
"cell_type": "markdown",
49125
"id": "079c0ec3",
50126
"metadata": {},
51127
"source": [
52-
"## Define the session of your choice"
128+
"<br> \n",
129+
"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",
130+
"\n",
131+
"## Define the session of your choice\n",
132+
"The following example calls use credentials/connectivity parameters as defined in the **Configuration//credentials.ipynb** file. \n",
133+
"\n",
134+
"Please edit **Configuration/credentials.ipynb** to set your credentials and run the next cell before continuing"
135+
]
136+
},
137+
{
138+
"cell_type": "code",
139+
"execution_count": null,
140+
"id": "af7ee821-4413-4754-9f38-c3a22725a962",
141+
"metadata": {},
142+
"outputs": [],
143+
"source": [
144+
"%run ../Configuration/credentials.ipynb"
53145
]
54146
},
55147
{
@@ -59,7 +151,7 @@
59151
"source": [
60152
"#### Desktop Session\n",
61153
"\n",
62-
"Create and open a Desktop session to Refintiv Eikon 4 or Refinitiv Workspace application - running locally."
154+
"Create and open a Desktop session to Refintiv Eikon 4 or Refinitiv Workspace application - running locally (using the **APP_KEY** defined in the above notebook)."
63155
]
64156
},
65157
{
@@ -160,37 +252,10 @@
160252
},
161253
{
162254
"cell_type": "code",
163-
"execution_count": 3,
255+
"execution_count": null,
164256
"id": "5eb4432c",
165257
"metadata": {},
166-
"outputs": [
167-
{
168-
"name": "stdout",
169-
"output_type": "stream",
170-
"text": [
171-
"[2021-09-03 10:53:56,954] - [INFO] - [sessions.desktop.default-session.0] - [28936] | MainThread\n",
172-
"Checking port 9000 response : 200 - {\"statusCode\":\"ST_PROXY_READY\",\"version\":\"2.9.0\"}\n",
173-
"[2021-09-03 10:53:56,957] - [INFO] - [sessions.desktop.default-session.0] - [28936] | MainThread\n",
174-
"Port 9000 was retrieved from .portInUse file\n",
175-
"[2021-09-03 10:53:56,959] - [INFO] - [sessions.desktop.default-session.0] - [28936] | MainThread\n",
176-
"Try to handshake on url http://localhost:9000/api/handshake...\n",
177-
"[2021-09-03 10:53:59,176] - [INFO] - [sessions.desktop.default-session.0] - [28936] | MainThread\n",
178-
"Response : 200 - {\"access_token\":\"\",\"expires_in\":1209600,\"token_type\":\"bearer\"}\n",
179-
"[2021-09-03 10:53:59,177] - [INFO] - [sessions.desktop.default-session.0] - [28936] | MainThread\n",
180-
"Application ID: xxx\n"
181-
]
182-
},
183-
{
184-
"data": {
185-
"text/plain": [
186-
"<SessionState.Open: 3>"
187-
]
188-
},
189-
"execution_count": 3,
190-
"metadata": {},
191-
"output_type": "execute_result"
192-
}
193-
],
258+
"outputs": [],
194259
"source": [
195260
"session.open()"
196261
]
@@ -258,29 +323,10 @@
258323
},
259324
{
260325
"cell_type": "code",
261-
"execution_count": 5,
326+
"execution_count": null,
262327
"id": "adb83bc9",
263328
"metadata": {},
264-
"outputs": [
265-
{
266-
"name": "stdout",
267-
"output_type": "stream",
268-
"text": [
269-
"Session State:EventCode.SessionAuthenticationSuccess | Successfully authorized to RDP authentication endpoint.\n",
270-
"Session State:SessionState.Open | Session is opened.\n"
271-
]
272-
},
273-
{
274-
"data": {
275-
"text/plain": [
276-
"<SessionState.Open: 3>"
277-
]
278-
},
279-
"execution_count": 5,
280-
"metadata": {},
281-
"output_type": "execute_result"
282-
}
283-
],
329+
"outputs": [],
284330
"source": [
285331
"# Callback to handle session state changes\n",
286332
"def on_state_cb(session, state_code, state_msg):\n",

0 commit comments

Comments
 (0)