WALMART SCREENSHOT SCRIPT DONEcd ~/Documents/Northpass! And emails from Groups for Wildhealth. Very productive day

This commit is contained in:
Norm Rasmussen
2023-01-31 16:24:35 -05:00
parent ab43ce9d90
commit 55eb10b0f5
17 changed files with 103 additions and 49 deletions

View File

@ -1,4 +1,5 @@
import requests
import pandas as pd
apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE"
# Wild Health
@ -8,21 +9,24 @@ groupurl = f"https://api.northpass.com/v2/groups/{groupid}/memberships"
def getemailsfromGroup(apiKey, groupid, groupurl):
x = 0
emails = []
emaillist = []
while True:
x += 1
url = groupurl
url = f"https://api.northpass.com/v2/groups/{groupid}/memberships?page={x}"
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)
for emails in jsonResponse["included"]:
email = emails["attributes"]["email"]
print(email)
emaillist.append(email)
if "next" not in next:
break
print(emails)
print(emaillist)
pd.DataFrame(emaillist).to_csv('/Users/normrasmussen/Downloads/emails_in_group.csv')
if __name__ == "__main__":