SPS and Walmart notes. Anthology, too.

This commit is contained in:
Norm Rasmussen
2023-05-24 16:56:19 -04:00
parent 6a1e560688
commit 0db819088b
12 changed files with 59 additions and 83 deletions

View File

@ -11,3 +11,4 @@ sps = "VNDXh8K4tLYJ-Nvp78bo6w"
anthology = "8ALsk8jDOlynEwn8ScMBSnG87"
talkspace_1099 = "jpfQoIc2i5S6iq4saFjBOEkbt"
doximity_internal = "vAnSR4CvxpII6buj3uT23MPBY"
terminus_employee = "M2er8m0DMQyCyP7zOg3Gbae9k"

View File

@ -2,7 +2,7 @@ import requests
import pandas as pd
import Apikeys
apiKey = Apikeys.walmartprod
apiKey = Apikeys.terminus_employee
course_dict = {}
@ -12,7 +12,7 @@ def get_course():
while True:
count += 1
url = f"https://api2.northpass.com/v2/courses?page={count}"
url = f"https://api.northpass.com/v2/courses?page={count}"
print(url)
headers = {"accept": "application/json", "X-Api-Key": apiKey}
response = requests.get(url, headers=headers)
@ -28,7 +28,7 @@ def get_course():
"id": uuid,
"name": name,
"status": status,
"build_url": build_url
# "build_url": build_url
# "url": f"https://walmart.northpass.com/app/courses/{uuid}",
}
@ -49,7 +49,7 @@ def get_cat_name(cat_id, course_dict, courses):
pass
elif len(cat_id) == 1:
categoryid = cat_id[0]["id"]
url = f"https://api2.northpass.com/v2/categories/{categoryid}"
url = f"https://api.northpass.com/v2/categories/{categoryid}"
cat_resp = requests.get(url, headers=headers)
cat_data = cat_resp.json()
cat_name = cat_data["data"]["attributes"]["name"]
@ -59,7 +59,7 @@ def get_cat_name(cat_id, course_dict, courses):
else:
for item in cat_id:
categoryid = item["id"]
url = f"https://api2.northpass.com/v2/categories/{categoryid}"
url = f"https://api.northpass.com/v2/categories/{categoryid}"
cat_resp = requests.get(url, headers=headers)
cat_data = cat_resp.json()
cat_name = cat_data["data"]["attributes"]["name"]
@ -76,7 +76,7 @@ def get_cat_name(cat_id, course_dict, courses):
def write_to_csv(courses):
df = pd.DataFrame.from_dict(courses)
df.to_csv("/Users/normrasmussen/Downloads/walmart_courses.csv")
df.to_csv("/Users/normrasmussen/Downloads/terminus_courses.csv")
if __name__ == "__main__":