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

View File

@ -0,0 +1 @@