Notes from SPS,Keystone,Walmart, and Glassdoor. Changed some templates in my sandbox.
This commit is contained in:
@ -7,4 +7,4 @@ normsandbox = "SlpQlju219WnWogn94dQUT6Yt"
|
||||
walmartprod = "6hUfJdAartHTHhHc0WIRZYPWe"
|
||||
recast = "9LISLpq7Ebqot3Xrggn5twKWZ"
|
||||
mizuno = "stXNF84HWL8aCGeRjHEo2rJ1U"
|
||||
|
||||
sps = "VNDXh8K4tLYJ-Nvp78bo6w"
|
||||
|
||||
Binary file not shown.
@ -1,16 +1,17 @@
|
||||
import requests
|
||||
import json
|
||||
import requests
|
||||
import Apikeys
|
||||
|
||||
|
||||
# url ="https://api.northpass.com/v2/groups/e6ef3e5f-b5a2-4b10-868b-8c165d76d263/learning_paths"
|
||||
# url = "https://api.northpass.com/v1/media?limit=1"
|
||||
# url = "https://api.northpass.com/v1/learning_paths"
|
||||
url = "https://api2.northpass.com/v2/courses"
|
||||
# url = "https://api2.northpass.com/v2/courses"
|
||||
|
||||
# function = sys.argv[1]
|
||||
apiKey = Apikeys.walmartprod
|
||||
# normuuid = "0b31c435-c18b-4573-984e-32cda57045b4"
|
||||
apiKey = Apikeys.normsandbox
|
||||
# normuuid = "3b2ac85d-2bdb-4183-a1c7-e0f49c58c4eb"
|
||||
group_uuid = "8be78542-ec43-4b5e-a662-77b403b4f049"
|
||||
|
||||
# Get Group Memberships:
|
||||
# url = "https://api.northpass.com/v2/groups/504c4771-223a-447f-9ec6-08e51bc9ca23/memberships"
|
||||
@ -21,6 +22,9 @@ apiKey = Apikeys.walmartprod
|
||||
# Associate a person with a Learning Path (Test):
|
||||
# url = f"https://api.northpass.com/v1/people/{normuuid}/relationships/learning_paths"
|
||||
|
||||
# Add Learning Paths to a Group (Test):
|
||||
url = f"https://api.northpass.com/v1/groups/{group_uuid}/relationships/learning_paths"
|
||||
|
||||
|
||||
def putTest(apiKey, url):
|
||||
payload = {
|
||||
@ -54,12 +58,16 @@ def getTest(apiKey, url):
|
||||
def postTest(apiKey, url):
|
||||
print(url)
|
||||
# Learning Path ID is for ID and change type to "enrolled-learning-paths"
|
||||
payload = {"data": [
|
||||
{
|
||||
"type": "enrolled-learning-paths",
|
||||
"id": "6ef5c9db-81d7-427c-846b-babb9a9a2ad1"
|
||||
}
|
||||
]}
|
||||
# payload = {"data": [
|
||||
# {
|
||||
# "type": "enrolled-learning-paths",
|
||||
# "id": "6ef5c9db-81d7-427c-846b-babb9a9a2ad1"
|
||||
# }
|
||||
# ]}
|
||||
# Add Learning Path to a Group Test
|
||||
payload = {"data": [{"type": "learning-paths", "id": "6ef5c9db-81d7-427c-846b-babb9a9a2ad1"}]}
|
||||
|
||||
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
@ -71,6 +79,6 @@ def postTest(apiKey, url):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
getTest(apiKey, url)
|
||||
# getTest(apiKey, url)
|
||||
# putTest(apiKey, url)
|
||||
# postTest(apiKey, url)
|
||||
postTest(apiKey, url)
|
||||
|
||||
13
Scripts/API_Tests/training_events.py
Normal file
13
Scripts/API_Tests/training_events.py
Normal file
@ -0,0 +1,13 @@
|
||||
import requests
|
||||
import Apikeys
|
||||
|
||||
|
||||
apikey = Apikeys.sps
|
||||
url = "https://api.northpass.com/v2/events"
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"X-Api-Key": apikey
|
||||
}
|
||||
response = requests.get(url, headers=headers)
|
||||
resp = response.json()
|
||||
print(resp)
|
||||
@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -16,7 +16,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 35,
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -30,19 +30,20 @@
|
||||
"dtype: object"
|
||||
]
|
||||
},
|
||||
"execution_count": 35,
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"pageviews = pd.read_csv(\"/Users/normrasmussen/Documents/Work/Data/GraphQuery (4).csv\")\n",
|
||||
"pd.set_option('display.max_rows', 100)\n",
|
||||
"pageviews = pd.read_csv(\"/Users/normrasmussen/Documents/Work/Data/GraphQuery (4).csv\", index_col=None)\n",
|
||||
"pageviews.dtypes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -210,7 +211,7 @@
|
||||
"[123 rows x 5 columns]"
|
||||
]
|
||||
},
|
||||
"execution_count": 36,
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@ -228,7 +229,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 37,
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -242,7 +243,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 41,
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -286,7 +287,7 @@
|
||||
" <td>1</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th rowspan=\"3\" valign=\"top\">'@properties Academy</th>\n",
|
||||
" <th rowspan=\"8\" valign=\"top\">'@properties Academy</th>\n",
|
||||
" <th>/account_links</th>\n",
|
||||
" <td>8</td>\n",
|
||||
" </tr>\n",
|
||||
@ -299,62 +300,195 @@
|
||||
" <td>4</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>...</th>\n",
|
||||
" <th>...</th>\n",
|
||||
" <td>...</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th rowspan=\"5\" valign=\"top\">ActiveLearner</th>\n",
|
||||
" <th>/courses/cgivmko2/builder/activities/QNpmEsyHk</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/courses/cgivmko2/builder/activities/Rh6JL0L9U</th>\n",
|
||||
" <td>5</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/courses/cgivmko2/builder/activities/T0kIBCfZt</th>\n",
|
||||
" <td>5</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/courses/cgivmko2/builder/activities/ZG38aHRFcX</th>\n",
|
||||
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/courses</th>\n",
|
||||
" <td>1</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/courses/cgivmko2/builder/activities/_Jtk3s0pt</th>\n",
|
||||
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/edit</th>\n",
|
||||
" <td>1</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/memberships</th>\n",
|
||||
" <td>8</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/memberships/new</th>\n",
|
||||
" <td>3</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/instructor_led_trainings</th>\n",
|
||||
" <td>11</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"<p>100 rows × 1 columns</p>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" apr_week\n",
|
||||
"academy path \n",
|
||||
" Vivvix University for Ad Intel /account_links 1\n",
|
||||
" /courses 1\n",
|
||||
"'@properties Academy /account_links 8\n",
|
||||
" /courses 11\n",
|
||||
" /groups 4\n",
|
||||
"... ...\n",
|
||||
"ActiveLearner /courses/cgivmko2/builder/activities/QNpmEsyHk 2\n",
|
||||
" /courses/cgivmko2/builder/activities/Rh6JL0L9U 5\n",
|
||||
" /courses/cgivmko2/builder/activities/T0kIBCfZt 5\n",
|
||||
" /courses/cgivmko2/builder/activities/ZG38aHRFcX 1\n",
|
||||
" /courses/cgivmko2/builder/activities/_Jtk3s0pt 1\n",
|
||||
"\n",
|
||||
"[100 rows x 1 columns]"
|
||||
" apr_week\n",
|
||||
"academy path \n",
|
||||
" Vivvix University for Ad Intel /account_links 1\n",
|
||||
" /courses 1\n",
|
||||
"'@properties Academy /account_links 8\n",
|
||||
" /courses 11\n",
|
||||
" /groups 4\n",
|
||||
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/co... 1\n",
|
||||
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/edit 1\n",
|
||||
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/me... 8\n",
|
||||
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/me... 3\n",
|
||||
" /instructor_led_trainings 11"
|
||||
]
|
||||
},
|
||||
"execution_count": 41,
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"pageviews = pageviews.groupby(['academy', 'path']).agg({'apr_week':'sum'})\n",
|
||||
"pageviews.head(100)"
|
||||
"#pageviews = pageviews.groupby(['academy', 'path']).agg({'apr_week':'sum'})\n",
|
||||
"#pageviews.head(10)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th></th>\n",
|
||||
" <th>apr_week</th>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>academy</th>\n",
|
||||
" <th>path</th>\n",
|
||||
" <th></th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th rowspan=\"2\" valign=\"top\">Vivvix University for Ad Intel</th>\n",
|
||||
" <th>/account_links</th>\n",
|
||||
" <td>1</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/courses</th>\n",
|
||||
" <td>1</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th rowspan=\"8\" valign=\"top\">'@properties Academy</th>\n",
|
||||
" <th>/account_links</th>\n",
|
||||
" <td>8</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/courses</th>\n",
|
||||
" <td>11</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/groups</th>\n",
|
||||
" <td>4</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/courses</th>\n",
|
||||
" <td>1</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/edit</th>\n",
|
||||
" <td>1</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/memberships</th>\n",
|
||||
" <td>8</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/memberships/new</th>\n",
|
||||
" <td>3</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>/instructor_led_trainings</th>\n",
|
||||
" <td>11</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" apr_week\n",
|
||||
"academy path \n",
|
||||
" Vivvix University for Ad Intel /account_links 1\n",
|
||||
" /courses 1\n",
|
||||
"'@properties Academy /account_links 8\n",
|
||||
" /courses 11\n",
|
||||
" /groups 4\n",
|
||||
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/co... 1\n",
|
||||
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/edit 1\n",
|
||||
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/me... 8\n",
|
||||
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/me... 3\n",
|
||||
" /instructor_led_trainings 11"
|
||||
]
|
||||
},
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"pageviews.reset_index\n",
|
||||
"pageviews.head(10)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 38,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"0 True\n",
|
||||
"1 True\n",
|
||||
"2 True\n",
|
||||
"3 True\n",
|
||||
"4 False\n",
|
||||
" ... \n",
|
||||
"13861 True\n",
|
||||
"13862 True\n",
|
||||
"13863 False\n",
|
||||
"13864 False\n",
|
||||
"13865 False\n",
|
||||
"Name: path, Length: 13866, dtype: bool"
|
||||
]
|
||||
},
|
||||
"execution_count": 38,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"startswith_list = ('/courses', '/people', 'learning_paths', '/instructor_led_trainings', '/preview', '/groups', '/account_links')\n",
|
||||
"#for root in startswith_list:\n",
|
||||
"# pageviews.path.str.startswith(root, na=False)\n",
|
||||
" #pageviews['root'] = pageviews.path.apply(lambda x: root if pageviews.path.str.startswith(root, na=False) else 'None')\n",
|
||||
"\n",
|
||||
"pageviews.path.str.startswith(startswith_list)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user