Got groups and courses for Walmart Supplier. Updated the carousel and recommended for Chubb - haven't pushed to prod yet.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -4,7 +4,7 @@ import pprint
|
||||
import csv
|
||||
|
||||
pp = pprint.PrettyPrinter(indent=4)
|
||||
APIKEY = Apikeys.EMPLOY
|
||||
APIKEY = Apikeys.SUPPLIERPROD
|
||||
HEADERS = {
|
||||
"accept": "application/json",
|
||||
"X-Api-Key": APIKEY,
|
||||
@ -22,8 +22,8 @@ def get_courses():
|
||||
while True:
|
||||
# for course_name in COURSES:
|
||||
count += 1
|
||||
# url = f"https://api.northpass.com/v2/courses/?filter[name][eq]={course_name}"
|
||||
url = f"https://api.northpass.com/v2/courses/?limit=100&page={count}"
|
||||
# url = f"https://api2.northpass.com/v2/courses/?filter[name][eq]={course_name}"
|
||||
url = f"https://api2.northpass.com/v2/courses/?limit=100&page={count}"
|
||||
response = requests.get(url, headers=HEADERS)
|
||||
response = response.json()
|
||||
nextlink = response["links"]
|
||||
@ -41,14 +41,14 @@ def get_courses():
|
||||
break
|
||||
|
||||
pp.pprint(list_of_ids)
|
||||
# print(len(list_of_ids))
|
||||
# with open(
|
||||
# "/Users/normrasmussen/Downloads/LuminateUS-Courses.csv", "a+", newline='\n'
|
||||
# ) as csvfile:
|
||||
# for group in list_of_ids:
|
||||
# for key, value in group.items():
|
||||
# csvwriter = csv.writer(csvfile)
|
||||
# csvwriter.writerow([key, value])
|
||||
print(len(list_of_ids))
|
||||
with open(
|
||||
"/Users/normrasmussen/Downloads/Supplier-Courses.csv", "a+", newline='\n'
|
||||
) as csvfile:
|
||||
for group in list_of_ids:
|
||||
for key, value in group.items():
|
||||
csvwriter = csv.writer(csvfile)
|
||||
csvwriter.writerow([key, value])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -2,8 +2,8 @@ import requests
|
||||
import Apikeys
|
||||
import pandas as pd
|
||||
|
||||
BASEURL = "https://api.northpass.com/v2/"
|
||||
APIKEY = Apikeys.SKAN
|
||||
BASEURL = "https://api2.northpass.com/v2/"
|
||||
APIKEY = Apikeys.SUPPLIERPROD
|
||||
HEADERS = {"X-Api-Key": APIKEY, "accept": "application/json"}
|
||||
|
||||
LISTGROUPS = "groups/"
|
||||
@ -27,7 +27,10 @@ def get_groups():
|
||||
if "next" not in nextlink:
|
||||
break
|
||||
|
||||
get_memberships(groups_list)
|
||||
# get_memberships(groups_list)
|
||||
df = pd.DataFrame.from_records(groups_list)
|
||||
print(df)
|
||||
df.to_csv("~/Downloads/Supplier_Groups.csv")
|
||||
|
||||
|
||||
def get_memberships(groups_list):
|
||||
|
||||
Reference in New Issue
Block a user