Changes?
This commit is contained in:
@ -4,3 +4,4 @@ forcemanager = "3ia7mWFkdeALYQFYoB51yh6Ov"
|
||||
talkspace_core = "2vfHw6ksqGfT1gUhPM8pXx2wW"
|
||||
wildhealth = "HWxj6VTNPwbc3WghFTPzr7SjE"
|
||||
normsandbox = "SlpQlju219WnWogn94dQUT6Yt"
|
||||
walmartprod = "6hUfJdAartHTHhHc0WIRZYPWe"
|
||||
|
||||
Binary file not shown.
@ -5,10 +5,12 @@ 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://api.northpass.com/v1/learning_paths"
|
||||
url = "https://api2.northpass.com/v2/courses"
|
||||
|
||||
# function = sys.argv[1]
|
||||
apiKey = Apikeys.normsandbox
|
||||
normuuid = "0b31c435-c18b-4573-984e-32cda57045b4"
|
||||
apiKey = Apikeys.walmartprod
|
||||
# normuuid = "0b31c435-c18b-4573-984e-32cda57045b4"
|
||||
|
||||
# Get Group Memberships:
|
||||
# url = "https://api.northpass.com/v2/groups/504c4771-223a-447f-9ec6-08e51bc9ca23/memberships"
|
||||
@ -17,7 +19,7 @@ normuuid = "0b31c435-c18b-4573-984e-32cda57045b4"
|
||||
# url = "https://api.northpass.com/v2/people/person_uuid/relationships/courses"
|
||||
|
||||
# Associate a person with a Learning Path (Test):
|
||||
url = f"https://api.northpass.com/v1/people/{normuuid}/relationships/learning_paths"
|
||||
# url = f"https://api.northpass.com/v1/people/{normuuid}/relationships/learning_paths"
|
||||
|
||||
|
||||
def putTest(apiKey, url):
|
||||
@ -69,6 +71,6 @@ def postTest(apiKey, url):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# getTest(apiKey, url)
|
||||
getTest(apiKey, url)
|
||||
# putTest(apiKey, url)
|
||||
postTest(apiKey, url)
|
||||
# postTest(apiKey, url)
|
||||
|
||||
38
Scripts/API_Tests/get_courses.py
Normal file
38
Scripts/API_Tests/get_courses.py
Normal file
@ -0,0 +1,38 @@
|
||||
import requests
|
||||
import json
|
||||
import Apikeys
|
||||
|
||||
|
||||
def get_course():
|
||||
count = 0
|
||||
apiKey = Apikeys.walmartprod
|
||||
live_courses = []
|
||||
|
||||
while True:
|
||||
count += 1
|
||||
url = f"https://api2.northpass.com/v2/courses?page={count}"
|
||||
headers = {"accept": "application/json", "X-Api-Key": apiKey}
|
||||
response = requests.get(url, headers=headers)
|
||||
data = response.json()
|
||||
nextlink = data["links"]
|
||||
|
||||
jsonResponse = response.json()
|
||||
jsonResponse = json.dumps(jsonResponse, indent=2)
|
||||
|
||||
for response in data["data"]:
|
||||
status = response["attributes"]["status"]
|
||||
if status == "live":
|
||||
name = response["attributes"]["name"]
|
||||
live_courses.append(name)
|
||||
with open("/Users/normrasmussen/Downloads/courses.txt", "a") as write:
|
||||
write.write("\n")
|
||||
write.write(name)
|
||||
|
||||
if "next" not in nextlink:
|
||||
break
|
||||
|
||||
print(live_courses)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_course()
|
||||
Reference in New Issue
Block a user