New script, walmart notes, etc
This commit is contained in:
@ -2,16 +2,22 @@ import requests
|
||||
|
||||
# apiKey = "SlpQlju219WnWogn94dQUT6Yt"
|
||||
|
||||
apiKey = "3ia7mWFkdeALYQFYoB51yh6Ov"
|
||||
# apiKey = "3ia7mWFkdeALYQFYoB51yh6Ov"
|
||||
# ForceManager
|
||||
|
||||
# apiKey = "2vfHw6ksqGfT1gUhPM8pXx2wW"
|
||||
# apiKey = "2vfHw6ksqGfT1gUhPM8pXx2wW"
|
||||
# Talkspace Core
|
||||
|
||||
url ="https://api.northpass.com/v2/groups/e6ef3e5f-b5a2-4b10-868b-8c165d76d263/learning_paths"
|
||||
apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE"
|
||||
# Wild Health
|
||||
|
||||
# url ="https://api.northpass.com/v2/groups/e6ef3e5f-b5a2-4b10-868b-8c165d76d263/learning_paths"
|
||||
# "https://api.northpass.com/v1/media"
|
||||
# function = sys.argv[1]
|
||||
|
||||
# Get Group Memberships:
|
||||
url = "https://api.northpass.com/v2/groups/504c4771-223a-447f-9ec6-08e51bc9ca23/memberships"
|
||||
|
||||
|
||||
def putTest(apiKey, url):
|
||||
|
||||
@ -33,10 +39,12 @@ def putTest(apiKey, url):
|
||||
def getTest(apiKey, url):
|
||||
headers = {"accept": "application/json", "X-Api-Key": apiKey}
|
||||
response = requests.get(url, headers=headers)
|
||||
print(response.text)
|
||||
# print(response.text)
|
||||
jsonResponse = response.json()
|
||||
print(jsonResponse["included"][1]["attributes"]["email"])
|
||||
# print(jsonResponse["data"][1]["attributes"])
|
||||
|
||||
|
||||
def postTest(apiKey, url):
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
|
||||
29
Scripts/API_Tests/getemails_group.py
Normal file
29
Scripts/API_Tests/getemails_group.py
Normal file
@ -0,0 +1,29 @@
|
||||
import requests
|
||||
|
||||
apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE"
|
||||
# Wild Health
|
||||
groupid = "504c4771-223a-447f-9ec6-08e51bc9ca23"
|
||||
groupurl = f"https://api.northpass.com/v2/groups/{groupid}/memberships"
|
||||
|
||||
|
||||
def getemailsfromGroup(apiKey, groupid, groupurl):
|
||||
x = 0
|
||||
emails = []
|
||||
while True:
|
||||
x += 1
|
||||
url = groupurl
|
||||
headers = {"accept": "application/json", "X-Api-Key": apiKey}
|
||||
response = requests.get(url, headers=headers)
|
||||
jsonResponse = response.json()
|
||||
next = jsonResponse["links"]
|
||||
|
||||
for email in jsonResponse["included"][1]["attributes"]["email"]:
|
||||
emails.append(email)
|
||||
|
||||
if "next" not in next:
|
||||
break
|
||||
print(emails)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
getemailsfromGroup(apiKey, groupid, groupurl)
|
||||
Reference in New Issue
Block a user