Mostly migration work. Some Api test script updates.
This commit is contained in:
@ -5,7 +5,7 @@ FORCEMANAGER = "3ia7mWFkdeALYQFYoB51yh6Ov"
|
||||
TALKSPACE_CORE = "2vfHw6ksqGfT1gUhPM8pXx2wW"
|
||||
WILDHEALTH_EDPORTAL = "HWxj6VTNPwbc3WghFTPzr7SjE"
|
||||
NORMSANDBOX = "SlpQlju219WnWogn94dQUT6Yt"
|
||||
WALMARTPROD = "6hUfJdAartHTHhHc0WIRZYPWe"
|
||||
SPARKPROD = "6hUfJdAartHTHhHc0WIRZYPWe"
|
||||
RECAST = "9LISLpq7Ebqot3Xrggn5twKWZ"
|
||||
MIZUNO = "stXNF84HWL8aCGeRjHEo2rJ1U"
|
||||
MIZUNO_RUNNING = "XeRrtgm0BFYPjOjPekVwCdGkW"
|
||||
|
||||
Binary file not shown.
@ -11,7 +11,7 @@ HEADERS = {
|
||||
"X-Api-Key": APIKEY,
|
||||
}
|
||||
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():
|
||||
|
||||
@ -7,7 +7,7 @@ import requests
|
||||
import pandas as pd
|
||||
import Apikeys
|
||||
|
||||
APIKEY = Apikeys.ANTHOLOGY
|
||||
APIKEY = Apikeys.SPARKPROD
|
||||
COURSES = []
|
||||
HEADERS = {"accept": "application/json", "X-Api-Key": APIKEY}
|
||||
|
||||
@ -23,7 +23,7 @@ def get_course():
|
||||
|
||||
while True:
|
||||
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)
|
||||
data = response.json()
|
||||
nextlink = data["links"]
|
||||
@ -36,13 +36,15 @@ def get_course():
|
||||
name = response["attributes"]["name"]
|
||||
# full_description = response["attributes"]["full_description"]
|
||||
cprop = get_props(uuid)
|
||||
print(cprop)
|
||||
course_dict = {
|
||||
"id": uuid,
|
||||
"name": name,
|
||||
"status": status,
|
||||
"product_names": cprop,
|
||||
# "product_names": cprop,
|
||||
# "full_description": full_description,
|
||||
}
|
||||
course_dict.update(cprop)
|
||||
print(course_dict)
|
||||
|
||||
try:
|
||||
@ -60,13 +62,15 @@ def get_course():
|
||||
|
||||
|
||||
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)
|
||||
cdata = cprop_resp.json()
|
||||
prop_dict = {}
|
||||
|
||||
for ckey, cval in cdata["data"]["attributes"]["properties"].items():
|
||||
if ckey == "product_names_for_course_cards":
|
||||
return cval
|
||||
# if ckey == "product_names_for_course_cards":
|
||||
prop_dict[ckey] = cval
|
||||
return prop_dict
|
||||
|
||||
|
||||
def write_to_csv(courses):
|
||||
@ -75,7 +79,7 @@ def write_to_csv(courses):
|
||||
Takes on parameter, the list of 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__":
|
||||
|
||||
@ -3,7 +3,6 @@ import requests
|
||||
|
||||
# JSON Payload for SCORM file
|
||||
baseurl = "https://api.northpass.com"
|
||||
endpoint = f"{baseUrl}/v2/migration/projects/{projectid}/items/{activityitemid}/activity_resources"
|
||||
|
||||
# Migration Sandbox Items
|
||||
# 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"
|
||||
|
||||
# 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
|
||||
endpoint = f"{baseurl}/v2/migration/projects/{project_uuid}/items/{item_uuid}/activity_resources"
|
||||
headers = { "X-Api-Key": apikey, "content-type": "application/json" }
|
||||
payload = {
|
||||
"data": [
|
||||
@ -23,14 +27,15 @@ payload = {
|
||||
"uuid": "6aeea279-e70e-40b8-98a0-776fa93779d8",
|
||||
"display_name": "SCORM File 38",
|
||||
"data": {
|
||||
"name": "Introduction to Agile - SCORM",
|
||||
"name": "Introduction to Agile SCORM",
|
||||
"type": "activities/scorm_sco",
|
||||
"course_id": course_uuid,
|
||||
"section_id": "72efe0d0-b8ae-48db-ac71-cd2f450ec2e8",
|
||||
"section_id": section_uuid,
|
||||
"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",
|
||||
"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.status_code)
|
||||
|
||||
@ -309,10 +309,10 @@ def check_resources():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
delete_all_projects()
|
||||
# delete_all_projects()
|
||||
# read_json_docs()
|
||||
# create_project()
|
||||
# get_all_projects()
|
||||
get_all_projects()
|
||||
# get_specific_project()
|
||||
# create_enrollment()
|
||||
# check_resources()
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -4,7 +4,7 @@ import pprint
|
||||
|
||||
|
||||
PP = pprint.PrettyPrinter(indent=4)
|
||||
APIKEY = apikeys.SANDBOX
|
||||
APIKEY = apikeys.NORMSANDBOX
|
||||
HEADERS = {"content-type": "application/json", "X-Api-Key": APIKEY}
|
||||
BASEURL = "https://api.northpass.com/v2"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user