import requests baseUrl = "https://api.northpass.com/v2/people/" baseUrlname = "https://api.northpass.com/v2/people?filter[name][eq]=" baseUrlemail = "https://api.northpass.com/v2/people?filter[email][eq]=" apiKey = "JRDpCGQ7vSRiva6t5OkWDr5eJ" # G2 # apiKey = "6hUfJdAartHTHhHc0WIRZYPWe" #Walmart def getfromName(baseUrlname, apiKey): name = "Someone else" url = baseUrlname + f"{name}" headers = { "accept": "*/*", "x-api-key": apiKey, "content-type": "application/json", } response = requests.get(url, headers=headers) if response.status_code == 200: print("200 Response!") else: print("Another error! " + response.status_code) response = response.json() # print(response) # uuid = response["data"][0]["id"] # print("Learner ID:" ) # print(uuid) def getfromEmail(baseUrlemail, apiKey): # email = "norm2test@northpass.com" # The %2B encodes the + sign in the URL. Using the + sign won't work. email = " " url = baseUrlemail + f"{email}" print(url) headers = { "accept": "*/*", "x-api-key": apiKey, "content-type": "application/json", } response = requests.get(url, headers=headers) print(response) if response.status_code == 200: print("200 Error!") else: print("Another Error!") response = response.json() # print(response) uuid = response["data"] # print("Learner ID:" ) # print(uuid) def getfromUuid(baseUrl, apiKey): uuid = "57b2b5eb-aa56-4cee-bb32-8c678a2de1b7" url = baseUrl + uuid headers = { "accept": "*/*", "x-api-key": apiKey, "content-type": "application/json", } response = requests.get(url, headers=headers) print(response.status_code) print(response.text) if __name__ == "__main__": getfromUuid(baseUrl, apiKey) # getfromEmail(baseUrlemail, apiKey) # getfromName(baseUrlname, apiKey)