This commit is contained in:
Norm Rasmussen
2023-06-26 19:05:11 -04:00
parent d65e44450e
commit e259b87bf6
2 changed files with 13 additions and 10 deletions

View File

@ -38,7 +38,7 @@ def getfromEmail(emails, baseUrlemail, apiKey, data):
print("Another Error!")
data["uuid"] = data["email"].map(email_ids)
data.dropna(how='any', inplace=True)
data.dropna(how="any", inplace=True)
assignProps(data, apiKey)
errorstoCsv(errors)
@ -46,9 +46,9 @@ def getfromEmail(emails, baseUrlemail, apiKey, data):
def errorstoCsv(errors):
errorcsv = pd.DataFrame(errors)
errorcsv.to_csv(
path_or_buf="/Users/normrasmussen/Downloads/Emails_Not_Northpass.csv",
index=False
)
path_or_buf="/Users/normrasmussen/Downloads/Emails_Not_Northpass.csv",
index=False,
)
def assignProps(data, apiKey):
@ -59,14 +59,16 @@ def assignProps(data, apiKey):
uuid = row[4]
url = "https://api.northpass.com/v2/properties/people/bulk"
payload = {
"data": [{
"data": [
{
"type": "person_properties",
"attributes": {"properties": {
"user_id": ts_id,
"role_type": ts_role
}},
"attributes": {
"properties": {"user_id": ts_id, "role_type": ts_role}
},
"id": uuid,
}]}
}
]
}
headers = {
"accept": "application/json",
"content-type": "application/json",