WALMART SCREENSHOT SCRIPT DONEcd ~/Documents/Northpass! And emails from Groups for Wildhealth. Very productive day
This commit is contained in:
@ -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__":
|
||||
|
||||
Reference in New Issue
Block a user