Mostly migration work. Some Api test script updates.
This commit is contained in:
@ -5,7 +5,7 @@ FORCEMANAGER = "3ia7mWFkdeALYQFYoB51yh6Ov"
|
|||||||
TALKSPACE_CORE = "2vfHw6ksqGfT1gUhPM8pXx2wW"
|
TALKSPACE_CORE = "2vfHw6ksqGfT1gUhPM8pXx2wW"
|
||||||
WILDHEALTH_EDPORTAL = "HWxj6VTNPwbc3WghFTPzr7SjE"
|
WILDHEALTH_EDPORTAL = "HWxj6VTNPwbc3WghFTPzr7SjE"
|
||||||
NORMSANDBOX = "SlpQlju219WnWogn94dQUT6Yt"
|
NORMSANDBOX = "SlpQlju219WnWogn94dQUT6Yt"
|
||||||
WALMARTPROD = "6hUfJdAartHTHhHc0WIRZYPWe"
|
SPARKPROD = "6hUfJdAartHTHhHc0WIRZYPWe"
|
||||||
RECAST = "9LISLpq7Ebqot3Xrggn5twKWZ"
|
RECAST = "9LISLpq7Ebqot3Xrggn5twKWZ"
|
||||||
MIZUNO = "stXNF84HWL8aCGeRjHEo2rJ1U"
|
MIZUNO = "stXNF84HWL8aCGeRjHEo2rJ1U"
|
||||||
MIZUNO_RUNNING = "XeRrtgm0BFYPjOjPekVwCdGkW"
|
MIZUNO_RUNNING = "XeRrtgm0BFYPjOjPekVwCdGkW"
|
||||||
|
|||||||
Binary file not shown.
@ -11,7 +11,7 @@ HEADERS = {
|
|||||||
"X-Api-Key": APIKEY,
|
"X-Api-Key": APIKEY,
|
||||||
}
|
}
|
||||||
BASEURL = "https://api.northpass.com/v2/"
|
BASEURL = "https://api.northpass.com/v2/"
|
||||||
IMPORTFILE = "/Users/normrasmussen/Downloads/cisa-112924.csv"
|
IMPORTFILE = "/Users/normrasmussen/Downloads/cisa-121724.csv"
|
||||||
|
|
||||||
|
|
||||||
def bulk_invite_and_group():
|
def bulk_invite_and_group():
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import requests
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import Apikeys
|
import Apikeys
|
||||||
|
|
||||||
APIKEY = Apikeys.ANTHOLOGY
|
APIKEY = Apikeys.SPARKPROD
|
||||||
COURSES = []
|
COURSES = []
|
||||||
HEADERS = {"accept": "application/json", "X-Api-Key": APIKEY}
|
HEADERS = {"accept": "application/json", "X-Api-Key": APIKEY}
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ def get_course():
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
count += 1
|
count += 1
|
||||||
url = f"https://api.northpass.com/v2/courses?page={count}"
|
url = f"https://api2.northpass.com/v2/courses?page={count}"
|
||||||
response = requests.get(url, headers=HEADERS)
|
response = requests.get(url, headers=HEADERS)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
nextlink = data["links"]
|
nextlink = data["links"]
|
||||||
@ -36,13 +36,15 @@ def get_course():
|
|||||||
name = response["attributes"]["name"]
|
name = response["attributes"]["name"]
|
||||||
# full_description = response["attributes"]["full_description"]
|
# full_description = response["attributes"]["full_description"]
|
||||||
cprop = get_props(uuid)
|
cprop = get_props(uuid)
|
||||||
|
print(cprop)
|
||||||
course_dict = {
|
course_dict = {
|
||||||
"id": uuid,
|
"id": uuid,
|
||||||
"name": name,
|
"name": name,
|
||||||
"status": status,
|
"status": status,
|
||||||
"product_names": cprop,
|
# "product_names": cprop,
|
||||||
# "full_description": full_description,
|
# "full_description": full_description,
|
||||||
}
|
}
|
||||||
|
course_dict.update(cprop)
|
||||||
print(course_dict)
|
print(course_dict)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -60,13 +62,15 @@ def get_course():
|
|||||||
|
|
||||||
|
|
||||||
def get_props(uuid):
|
def get_props(uuid):
|
||||||
cprop_url = f"https://api.northpass.com/v2/properties/courses/{uuid}?filter[]"
|
cprop_url = f"https://api2.northpass.com/v2/properties/courses/{uuid}?filter[]"
|
||||||
cprop_resp = requests.get(cprop_url, headers=HEADERS)
|
cprop_resp = requests.get(cprop_url, headers=HEADERS)
|
||||||
cdata = cprop_resp.json()
|
cdata = cprop_resp.json()
|
||||||
|
prop_dict = {}
|
||||||
|
|
||||||
for ckey, cval in cdata["data"]["attributes"]["properties"].items():
|
for ckey, cval in cdata["data"]["attributes"]["properties"].items():
|
||||||
if ckey == "product_names_for_course_cards":
|
# if ckey == "product_names_for_course_cards":
|
||||||
return cval
|
prop_dict[ckey] = cval
|
||||||
|
return prop_dict
|
||||||
|
|
||||||
|
|
||||||
def write_to_csv(courses):
|
def write_to_csv(courses):
|
||||||
@ -75,7 +79,7 @@ def write_to_csv(courses):
|
|||||||
Takes on parameter, the list of courses.
|
Takes on parameter, the list of courses.
|
||||||
"""
|
"""
|
||||||
df = pd.DataFrame.from_dict(courses)
|
df = pd.DataFrame.from_dict(courses)
|
||||||
df.to_csv("/Users/normrasmussen/Downloads/courses_with_property.csv")
|
df.to_csv("/Users/normrasmussen/Downloads/Spark_courses_with_property.csv")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import requests
|
|||||||
|
|
||||||
# JSON Payload for SCORM file
|
# JSON Payload for SCORM file
|
||||||
baseurl = "https://api.northpass.com"
|
baseurl = "https://api.northpass.com"
|
||||||
endpoint = f"{baseUrl}/v2/migration/projects/{projectid}/items/{activityitemid}/activity_resources"
|
|
||||||
|
|
||||||
# Migration Sandbox Items
|
# Migration Sandbox Items
|
||||||
# projectid = "f33ce6c1-65cf-48a2-96c8-825beee2ff88"
|
# projectid = "f33ce6c1-65cf-48a2-96c8-825beee2ff88"
|
||||||
@ -11,9 +10,14 @@ endpoint = f"{baseUrl}/v2/migration/projects/{projectid}/items/{activityitemid}/
|
|||||||
# course_uuid = "07b97dea-ca66-4a9c-ae32-ebf3aa7205c2"
|
# course_uuid = "07b97dea-ca66-4a9c-ae32-ebf3aa7205c2"
|
||||||
|
|
||||||
# Norm's Sandbox Items:
|
# Norm's Sandbox Items:
|
||||||
course_uuid = "5bee0361-3161-4d9b-9369-cba4bb4b2d84"
|
course_uuid = "1de95b11-f2b6-473c-9637-4a6b5f9f98be"
|
||||||
|
project_uuid = "a1a36fbf-f11e-40c7-add4-89a0ae7bf76c"
|
||||||
|
item_uuid = "3bec2531-705a-47c1-a1b6-5c68ec955698"
|
||||||
|
scorm_uuid = "a030164d-00b1-430c-8f41-211416d573e2"
|
||||||
|
section_uuid = "b6414605-9d43-4f27-9f85-bccd5928bafb"
|
||||||
|
|
||||||
apikey = apikeys.NORMSANDBOX
|
apikey = apikeys.NORMSANDBOX
|
||||||
|
endpoint = f"{baseurl}/v2/migration/projects/{project_uuid}/items/{item_uuid}/activity_resources"
|
||||||
headers = { "X-Api-Key": apikey, "content-type": "application/json" }
|
headers = { "X-Api-Key": apikey, "content-type": "application/json" }
|
||||||
payload = {
|
payload = {
|
||||||
"data": [
|
"data": [
|
||||||
@ -23,14 +27,15 @@ payload = {
|
|||||||
"uuid": "6aeea279-e70e-40b8-98a0-776fa93779d8",
|
"uuid": "6aeea279-e70e-40b8-98a0-776fa93779d8",
|
||||||
"display_name": "SCORM File 38",
|
"display_name": "SCORM File 38",
|
||||||
"data": {
|
"data": {
|
||||||
"name": "Introduction to Agile - SCORM",
|
"name": "Introduction to Agile SCORM",
|
||||||
"type": "activities/scorm_sco",
|
"type": "activities/scorm_sco",
|
||||||
"course_id": course_uuid,
|
"course_id": course_uuid,
|
||||||
"section_id": "72efe0d0-b8ae-48db-ac71-cd2f450ec2e8",
|
"section_id": section_uuid,
|
||||||
"activity_attributes": {
|
"activity_attributes": {
|
||||||
"scorm_sco_id": "a1ee4933-74b9-4d5f-ab88-380db1d04d7a",
|
"upload_id": scorm_uuid,
|
||||||
"description": "Explore Agile as a concept and why it's effective in today's project environments. SCORM file",
|
"description": "Explore Agile as a concept and why it's effective in today's project environments. SCORM file",
|
||||||
"position": 5,
|
"body": scorm_uuid,
|
||||||
|
"position": 2
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -38,6 +43,6 @@ payload = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
# post_load = requests.post(endpoint, headers=headers, json=payload)
|
post_load = requests.post(endpoint, headers=headers, json=payload)
|
||||||
print(post_load.text)
|
print(post_load.text)
|
||||||
print(post_load.status_code)
|
print(post_load.status_code)
|
||||||
|
|||||||
@ -309,10 +309,10 @@ def check_resources():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
delete_all_projects()
|
# delete_all_projects()
|
||||||
# read_json_docs()
|
# read_json_docs()
|
||||||
# create_project()
|
# create_project()
|
||||||
# get_all_projects()
|
get_all_projects()
|
||||||
# get_specific_project()
|
# get_specific_project()
|
||||||
# create_enrollment()
|
# create_enrollment()
|
||||||
# check_resources()
|
# check_resources()
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -4,7 +4,7 @@ import pprint
|
|||||||
|
|
||||||
|
|
||||||
PP = pprint.PrettyPrinter(indent=4)
|
PP = pprint.PrettyPrinter(indent=4)
|
||||||
APIKEY = apikeys.SANDBOX
|
APIKEY = apikeys.NORMSANDBOX
|
||||||
HEADERS = {"content-type": "application/json", "X-Api-Key": APIKEY}
|
HEADERS = {"content-type": "application/json", "X-Api-Key": APIKEY}
|
||||||
BASEURL = "https://api.northpass.com/v2"
|
BASEURL = "https://api.northpass.com/v2"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user