Created script to get sent webhooks from our endpoint. Not many filtering options. Update some templates for Spark, and Luminate.

This commit is contained in:
Norm Rasmussen
2024-11-26 16:39:18 -05:00
parent b0abcb7022
commit 991cdde784
11 changed files with 533 additions and 437 deletions

View File

@ -31,3 +31,4 @@ KARBON = "peQbnkfUnYLGPfIzyCxfLs634"
BLOOMERANG = "ewGDqLgsklMnytqzUka2wmgIi"
GSU = "rUUKNuBZ0rmRNPftB4smYhQ5L"
EMPLOY = "qcNggCm4SBtC0gTqLGv30vX8l"
LUMAFINTECH = "oDFA7XSmjEKjEwIDIKLm0rxs1"

View File

@ -12,20 +12,6 @@ HEADERS = {
}
BASEURL = "https://api.northpass.com/v2/"
GROUPS = [
"Academic Economics",
"Academy Use/Navigation",
"Accreditation",
"Anthology 101",
"Baseline",
"Course Evaluations",
"Engage",
"Evaluate",
"Finance & HCM",
"Learn",
"Portfolio",
"Power BI",
"Raise",
"Reach",
"Student",
]
@ -34,23 +20,24 @@ def all_groups():
Get all Group IDs
"""
gids = []
group_count = 0
while True:
group_count += 1
url = f"https://api.northpass.com/v2/groups?page={group_count}"
gresponse = requests.get(url, headers=HEADERS)
gdata = gresponse.json()
gnext = gdata["links"]
for group in GROUPS:
group_count = 0
while True:
group_count += 1
url = f"https://api.northpass.com/v2/groups?filter[name][cont]={group}&page={group_count}"
gresponse = requests.get(url, headers=HEADERS)
gdata = gresponse.json()
gnext = gdata["links"]
for response in gdata["data"]:
group_id = response["id"]
group_name = response["attributes"]["name"]
group_tupe = (group_id, group_name)
print(group_tupe)
gids.append(group_tupe)
for response in gdata["data"]:
group_id = response["id"]
group_name = response["attributes"]["name"]
group_tupe = (group_id, group_name)
print(group_tupe)
gids.append(group_tupe)
if "next" not in gnext:
break
if "next" not in gnext:
break
get_courses(gids)

View File

@ -0,0 +1,17 @@
import requests
import Apikeys
import pprint
PP = pprint.PrettyPrinter(indent=4)
APIKEY = Apikeys.LUMAFINTECH
HEADERS = {"content-type": "application/json", "X-Api-Key": APIKEY }
BASEURL = "https://api.northpass.com/v2/webhooks"
FILTURL = f"{BASEURL}?filter[attempt_left][eq]=28"
# filter[type][in]=course_completed_events
print(FILTURL)
response = requests.get(FILTURL, headers=HEADERS)
resp = response.json()
for i in resp['data']:
print(i['attributes']['created_at'] )
# PP.pprint(resp)