Skip to content

Commit 5e1dc7a

Browse files
committed
tested with dev9
Minor tweaks etc to complete testing with dev9
1 parent 0d17dee commit 5e1dc7a

17 files changed

+3685
-3196
lines changed

1. Quick Start/1.0 - Sessions.ipynb

Lines changed: 92 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
},
6565
{
6666
"cell_type": "code",
67-
"execution_count": 11,
67+
"execution_count": 2,
6868
"id": "51fad442",
6969
"metadata": {},
7070
"outputs": [],
@@ -83,7 +83,7 @@
8383
},
8484
{
8585
"cell_type": "code",
86-
"execution_count": 8,
86+
"execution_count": null,
8787
"id": "62485c4a",
8888
"metadata": {},
8989
"outputs": [],
@@ -108,23 +108,10 @@
108108
},
109109
{
110110
"cell_type": "code",
111-
"execution_count": 9,
111+
"execution_count": null,
112112
"id": "76a9f215",
113113
"metadata": {},
114-
"outputs": [
115-
{
116-
"ename": "AttributeError",
117-
"evalue": "Please provide 'grant' attribute or set 'username' and 'password' in config.",
118-
"output_type": "error",
119-
"traceback": [
120-
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
121-
"\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)",
122-
"\u001b[1;32m<ipython-input-9-ee4ef0316817>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m session = rd.session.platform.Definition(\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[0mapp_key\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mAPP_KEY\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[0mdeployed_platform_host\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mDEPLOYED_PLATFORM_HOST\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mdeployed_platform_username\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mDEPLOYED_PLATFORM_USER_NAME\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m ).get_session()\n",
123-
"\u001b[1;32m~\\Anaconda3\\envs\\dev6\\lib\\site-packages\\refinitiv\\data\\_data\\core\\session\\_platform_session_definition.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, session_name, app_key, grant, signon_control, deployed_platform_host, deployed_platform_username, dacs_position, dacs_application_id)\u001b[0m\n\u001b[0;32m 93\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 94\u001b[0m \u001b[1;32mif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mgrant\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mis_valid\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 95\u001b[1;33m raise AttributeError(\n\u001b[0m\u001b[0;32m 96\u001b[0m \u001b[1;34m\"Please provide 'grant' attribute or set 'username' and 'password' in config.\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 97\u001b[0m )\n",
124-
"\u001b[1;31mAttributeError\u001b[0m: Please provide 'grant' attribute or set 'username' and 'password' in config."
125-
]
126-
}
127-
],
114+
"outputs": [],
128115
"source": [
129116
"session = rd.session.platform.Definition(\n",
130117
" app_key = APP_KEY, \n",
@@ -153,7 +140,7 @@
153140
"outputs": [],
154141
"source": [
155142
"session = rd.session.platform.Definition(\n",
156-
" APP_KEY, \n",
143+
" app_key = APP_KEY, \n",
157144
" grant = rd.session.platform.GrantPassword(\n",
158145
" username = RDP_LOGIN, \n",
159146
" password = RDP_PASSWORD\n",
@@ -173,10 +160,37 @@
173160
},
174161
{
175162
"cell_type": "code",
176-
"execution_count": null,
163+
"execution_count": 3,
177164
"id": "5eb4432c",
178165
"metadata": {},
179-
"outputs": [],
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\":\"***REMOVED***.eyJBcGlWZXJzaW9uIjoiMSIsIkFwcEtleSI6IjBmN2EyZDEzYmYyNzQ3ODk4N2QxYzc1ZjJjNWZkOGZjNDY5MGY3ZTEiLCJBcHBTY29wZSI6InRyYXBpIiwiTGlicmFyeU5hbWUiOiJSRFAgUHl0aG9uIExpYnJhcnkiLCJMaWJyYXJ5VmVyc2lvbiI6IjEuMC4wYTEuZGV2OSIsImlhdCI6MTYzMDY2MjgzOSwiZXhwIjoxNjMxODcyNDM5fQ.pHZg8YbWbKlK-zkgAG3CGMIbbT1AavmwWi5saL10zeI\",\"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: 0f7a2d13bf27478987d1c75f2c5fd8fc4690f7e1\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+
],
180194
"source": [
181195
"session.open()"
182196
]
@@ -214,10 +228,21 @@
214228
},
215229
{
216230
"cell_type": "code",
217-
"execution_count": null,
231+
"execution_count": 4,
218232
"id": "f628d577",
219233
"metadata": {},
220-
"outputs": [],
234+
"outputs": [
235+
{
236+
"data": {
237+
"text/plain": [
238+
"<SessionState.Closed: 1>"
239+
]
240+
},
241+
"execution_count": 4,
242+
"metadata": {},
243+
"output_type": "execute_result"
244+
}
245+
],
221246
"source": [
222247
"session.close()"
223248
]
@@ -233,10 +258,29 @@
233258
},
234259
{
235260
"cell_type": "code",
236-
"execution_count": null,
261+
"execution_count": 5,
237262
"id": "adb83bc9",
238263
"metadata": {},
239-
"outputs": [],
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+
],
240284
"source": [
241285
"# Callback to handle session state changes\n",
242286
"def on_state_cb(session, state_code, state_msg):\n",
@@ -247,38 +291,50 @@
247291
"\n",
248292
"# Using PlatformSession - can be applied to DesktopSession as well\n",
249293
"session = rd.session.platform.Definition(\n",
250-
" APP_KEY, \n",
251-
" rd.session.platform.GrantPassword(\n",
252-
" username = RDP_LOGIN, \n",
294+
" app_key=APP_KEY,\n",
295+
" grant=rd.session.platform.GrantPassword(\n",
296+
" username = RDP_LOGIN,\n",
253297
" password = RDP_PASSWORD\n",
254-
" ),\n",
255-
" on_state=on_state_cb, on_event=on_event_cb\n",
298+
" )\n",
256299
").get_session()\n",
257-
" \n",
300+
"\n",
301+
"# Set your callbacks for handing the session events\n",
302+
"session.on_event(on_event_cb)\n",
303+
"session.on_state(on_state_cb)\n",
304+
"\n",
305+
"# Open the Session\n",
258306
"session.open()\n",
259307
"\n",
260308
"#\n",
261309
"# Run your application code\n",
262-
"#\n",
263-
"\n",
310+
"#\n"
311+
]
312+
},
313+
{
314+
"cell_type": "code",
315+
"execution_count": 6,
316+
"id": "f2bfad89-53d1-4e22-9903-3eba81159252",
317+
"metadata": {},
318+
"outputs": [],
319+
"source": [
264320
"# close the session when done\n",
265321
"session.close()"
266322
]
267323
},
268324
{
269325
"cell_type": "code",
270326
"execution_count": null,
271-
"id": "52567fb6-86e6-4661-b09e-041fceef1cd2",
327+
"id": "8119442c-31d2-436c-a2ab-4200700fb248",
272328
"metadata": {},
273329
"outputs": [],
274330
"source": []
275331
}
276332
],
277333
"metadata": {
278334
"kernelspec": {
279-
"display_name": "rddev6",
335+
"display_name": "RevData39",
280336
"language": "python",
281-
"name": "rddev6"
337+
"name": "rd39"
282338
},
283339
"language_info": {
284340
"codemirror_mode": {
@@ -290,7 +346,7 @@
290346
"name": "python",
291347
"nbconvert_exporter": "python",
292348
"pygments_lexer": "ipython3",
293-
"version": "3.8.10"
349+
"version": "3.9.4"
294350
}
295351
},
296352
"nbformat": 4,

0 commit comments

Comments
 (0)