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)
