Sandata and Walmart Luminate. Small changes to bulk upload script.

This commit is contained in:
Norm Rasmussen
2024-06-13 19:01:00 -04:00
parent 310610acff
commit 15d60be16c
3 changed files with 14 additions and 10 deletions

View File

@ -6,13 +6,13 @@ import pandas as pd
import Apikeys
pp = pprint.PrettyPrinter(indent=4)
APIKEY = Apikeys.CHUBB
APIKEY = Apikeys.SANDATA
HEADERS = {
"accept": "application/json",
"X-Api-Key": APIKEY,
}
BASEURL = "https://api.northpass.com/v2/"
IMPORTFILE = "/Users/normrasmussen/Downloads/chubb.csv"
IMPORTFILE = "/Users/normrasmussen/Downloads/sandata-employees.csv"
def bulk_invite_and_group():
@ -59,14 +59,17 @@ def bulk_invite_and_group():
print(f"Completed. Status code is {response.status_code}")
print(response.text)
# add_props()
def add_props():
errorlist = []
df = pd.DataFrame()
data = pd.read_csv(IMPORTFILE)
for dat in data.iterrows():
agency_name = dat[1][3]
learner_email = dat[1][2]
# agency_name = dat[1][3]
agency_name = "EMPLOYEE"
learner_email = dat[1][1]
print(learner_email)
ppl_search = f"{BASEURL}people?filter[email][eq]={learner_email}"
ppl_response = requests.get(ppl_search, headers=HEADERS)
try:
@ -79,7 +82,7 @@ def add_props():
payload = {
"data": [
{
"attributes": {"properties": {"agency name": agency_name }},
"attributes": {"properties": {"medicaid_id": agency_name }},
"id": learner_uuid,
"type": "person_properties",
}
@ -99,5 +102,5 @@ def add_props():
if __name__ == "__main__":
# bulk_invite_and_group()
add_props()
#bulk_invite_and_group()