TS props script, notes
This commit is contained in:
36
Scripts/API_Tests/enrollments.py
Normal file
36
Scripts/API_Tests/enrollments.py
Normal file
@ -0,0 +1,36 @@
|
||||
import requests
|
||||
import pandas as pd
|
||||
|
||||
# SPS Commerce
|
||||
apiKey = "VNDXh8K4tLYJ-Nvp78bo6w"
|
||||
|
||||
|
||||
def getEnrollments(apiKey):
|
||||
course_uuid = input("What is the Course UUID? Enter it here: ")
|
||||
x = 0
|
||||
uuid = []
|
||||
while True:
|
||||
x += 1
|
||||
url = f"https://api.northpass.com/v2/courses/{course_uuid}/enrollments"
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"X-Api-Key": apiKey
|
||||
}
|
||||
response = requests.get(url, headers=headers)
|
||||
jsonResponse = response.json()
|
||||
next = jsonResponse["links"]
|
||||
|
||||
for id in jsonResponse["data"]:
|
||||
userid= id["attributes"]["person_id"]
|
||||
|
||||
email= id["attributes"]["progress"]
|
||||
uuid.append(user)
|
||||
|
||||
if "next" not in next:
|
||||
break
|
||||
|
||||
# def getCourse():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
getEnrollments(apiKey)
|
||||
Reference in New Issue
Block a user