Larson notes. Some changes to templates
This commit is contained in:
@ -8,6 +8,6 @@ walmartprod = "6hUfJdAartHTHhHc0WIRZYPWe"
|
||||
recast = "9LISLpq7Ebqot3Xrggn5twKWZ"
|
||||
mizuno = "stXNF84HWL8aCGeRjHEo2rJ1U"
|
||||
sps = "VNDXh8K4tLYJ-Nvp78bo6w"
|
||||
anthology = "BwDUDT3mM6xzubFOgrPZNfL53"
|
||||
anthology = "8ALsk8jDOlynEwn8ScMBSnG87"
|
||||
talkspace_1099 = "jpfQoIc2i5S6iq4saFjBOEkbt"
|
||||
doximity_internal = "vAnSR4CvxpII6buj3uT23MPBY"
|
||||
|
||||
Binary file not shown.
@ -6,15 +6,20 @@ apiKey = Apikeys.doximity_internal
|
||||
|
||||
|
||||
def get_email():
|
||||
error_list = []
|
||||
df = pd.read_csv("/Users/normrasmussen/Downloads/doximity.csv")
|
||||
for row in df.itertuples():
|
||||
email = row[1]
|
||||
email = email.lower()
|
||||
group_id = row[2]
|
||||
# get_uuid(email, group_id, apiKey)
|
||||
print(f"Email: {email} & Group: {group_id}")
|
||||
group_id = group_id.replace("'", "")
|
||||
get_uuid(email, group_id, apiKey, error_list)
|
||||
# print(f"Email: {email} & Group: {group_id}")
|
||||
print(error_list)
|
||||
|
||||
|
||||
def get_uuid(email, group_id, apiKey):
|
||||
def get_uuid(email, group_id, apiKey, error_list):
|
||||
count = 0
|
||||
url = f"https://api.northpass.com/v2/people?filter[email][eq]={email}"
|
||||
headers = {
|
||||
"accept": "*/*",
|
||||
@ -22,14 +27,20 @@ def get_uuid(email, group_id, apiKey):
|
||||
"content-type": "application/json",
|
||||
}
|
||||
try:
|
||||
count += 1
|
||||
print(f"Row: {count}, email: {email}")
|
||||
response = requests.get(url, headers=headers)
|
||||
data = response.json()
|
||||
uuid = data["data"][0]["id"]
|
||||
add_to_group(apiKey, uuid, group_id)
|
||||
|
||||
try:
|
||||
uuid = data["data"][0]["id"]
|
||||
add_to_group(apiKey, uuid, group_id)
|
||||
except IndexError as e:
|
||||
print(f"Error, Index, {e}")
|
||||
error_list.append(email)
|
||||
pass
|
||||
response.raise_for_status()
|
||||
except requests.HTTPError as ex:
|
||||
print(f"Error!! Details - {ex}")
|
||||
print(f"Error getting the uuid!! Details - {ex}")
|
||||
raise ex
|
||||
except requests.Timeout:
|
||||
print("Timeout error")
|
||||
@ -51,12 +62,10 @@ def add_to_group(apiKey, uuid, group_id):
|
||||
print(response.status_code)
|
||||
response.raise_for_status()
|
||||
except requests.HTTPError as ex:
|
||||
print(f"Error!! Details - {ex}")
|
||||
print(f"Error adding to group!! Details - {ex}")
|
||||
raise ex
|
||||
except requests.Timeout:
|
||||
print("Timeout error")
|
||||
finally:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -4,27 +4,39 @@ import Apikeys
|
||||
apikey = Apikeys.anthology
|
||||
|
||||
groups_to_create = [
|
||||
'Engage', 'Encompass', 'Reach',
|
||||
'Student', 'Learn', 'Baseline', 'Ally',
|
||||
'Milestone','Raise', 'Accreditation',
|
||||
'Program Review', 'Portfolio', 'Outcomes',
|
||||
'Engage-Campus-wide Elections',
|
||||
'Engage-Co-Curricular Paths', 'Engage-ECIA',
|
||||
'Engage-Rooms and Reservations', 'Learn-Bb Reporting',
|
||||
'Learn-A4L']
|
||||
"Engage",
|
||||
"Encompass",
|
||||
"Reach",
|
||||
"Student",
|
||||
"Learn",
|
||||
"Baseline",
|
||||
"Ally",
|
||||
"Milestone",
|
||||
"Raise",
|
||||
"Accreditation",
|
||||
"Program Review",
|
||||
"Portfolio",
|
||||
"Outcomes",
|
||||
"Engage-Campus-wide Elections",
|
||||
"Engage-Co-Curricular Paths",
|
||||
"Engage-ECIA",
|
||||
"Engage-Rooms and Reservations",
|
||||
"Learn-Bb Reporting",
|
||||
"Learn-A4L",
|
||||
]
|
||||
|
||||
url = "https://api.northpass.com/v2/bulk/groups"
|
||||
headers = {
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": apikey,
|
||||
}
|
||||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
"X-Api-Key": apikey,
|
||||
}
|
||||
payload2 = []
|
||||
for group in groups_to_create:
|
||||
payload2.append({"name": group})
|
||||
payload = {"data": {"attributes": {"groups": payload2}}}
|
||||
|
||||
print(payload)
|
||||
# response = requests.post(url, json=payload, headers=headers)
|
||||
# print(response.text)
|
||||
# print(payload)
|
||||
response = requests.post(url, json=payload, headers=headers)
|
||||
print(response.text)
|
||||
# print(response)
|
||||
|
||||
Reference in New Issue
Block a user