Reorged notes, ready for the next step. Glassdoor notes. Some small script changes.

This commit is contained in:
Norm Rasmussen
2023-09-05 20:06:18 -04:00
parent 020d9fa764
commit 18271d15a4
79 changed files with 72 additions and 20479 deletions

View File

@ -2,7 +2,7 @@ import requests
import pandas as pd
import Apikeys
apiKey = Apikeys.terminus_employee
apiKey = Apikeys.walmartprod
course_dict = {}
@ -12,7 +12,7 @@ def get_course():
while True:
count += 1
url = f"https://api.northpass.com/v2/courses?page={count}"
url = f"https://api2.northpass.com/v2/courses?page={count}"
print(url)
headers = {"accept": "application/json", "X-Api-Key": apiKey}
response = requests.get(url, headers=headers)
@ -23,7 +23,7 @@ def get_course():
status = response["attributes"]["status"]
uuid = response["id"]
name = response["attributes"]["name"]
build_url = response["links"]["builder"]["href"]
# build_url = response["links"]["builder"]["href"]
course_dict = {
"id": uuid,
"name": name,
@ -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://api.northpass.com/v2/categories/{categoryid}"
url = f"https://api2.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://api.northpass.com/v2/categories/{categoryid}"
url = f"https://api2.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/terminus_courses.csv")
df.to_csv("/Users/normrasmussen/Downloads/walmart_course.csv")
if __name__ == "__main__":