You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jupyter-notebooks/tutorials/3_working_with_jobs.ipynb
+103-8Lines changed: 103 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@
21
21
"tags": []
22
22
},
23
23
"source": [
24
-
"## 0. Set up imports and predefined variables\n",
24
+
"## 0. Set up imports, predefined variables, and authentication\n",
25
25
"\n",
26
26
"For this Tutorial we will make use of a wrapper API that is called api.py (in the utils folder). It helps to manage things like authentication."
27
27
]
@@ -34,13 +34,108 @@
34
34
"outputs": [],
35
35
"source": [
36
36
"from utils import api\n",
37
+
"import getpass\n",
37
38
"import json\n",
38
39
"from IPython.display import JSON\n",
39
40
"import requests\n",
40
41
"import time\n",
41
42
"from datetime import datetime\n",
42
43
"\n",
43
-
"app_name = \"job-l1b-cwl:develop\""
44
+
"app_name = \"job-l1b-cwl:develop\"\n",
45
+
"\n",
46
+
"# This portion of the code is env specific for Dev, Test, Ops, etc. \n",
47
+
"# define the environment as our test venue\n",
48
+
"env = {\n",
49
+
"\"clientId\":\"71894molftjtie4dvvkbjeard0\",\n",
50
+
"}\n",
51
+
"\n",
52
+
"# The auth_json is template for authorizing with AWS Cognito for a token that can be used for calls to the data service.\n",
53
+
"# For now this is just an empty data structure. You will be prompted for your username and password in a few steps.\n",
54
+
"auth_json = '''{\n",
55
+
"\"AuthParameters\" : {\n",
56
+
"\"USERNAME\" : \"\",\n",
57
+
"\"PASSWORD\" : \"\"\n",
58
+
" },\n",
59
+
"\"AuthFlow\" : \"USER_PASSWORD_AUTH\",\n",
60
+
"\"ClientId\" : \"\"\n",
61
+
" }'''"
62
+
]
63
+
},
64
+
{
65
+
"cell_type": "markdown",
66
+
"id": "814a3678-dde6-44d9-ad94-5021b5813eb7",
67
+
"metadata": {
68
+
"tags": []
69
+
},
70
+
"source": [
71
+
"### Authentication Code\n",
72
+
"\n",
73
+
"The below method is a helper function for getting an access token for accessing Unity SDS services. You must pass the token along with any API requests in order to access the various Unity SDS services."
74
+
]
75
+
},
76
+
{
77
+
"cell_type": "code",
78
+
"execution_count": null,
79
+
"id": "dcd5e87b-8f36-4985-977a-e6b4bc3173b5",
80
+
"metadata": {
81
+
"tags": []
82
+
},
83
+
"outputs": [],
84
+
"source": [
85
+
"# This method is used for taking a username and password and client ID and fetching a cognito token\n",
0 commit comments