Anthology script for domain names. Used get courses for Walmart, and made a backup of the screenshots for 1-off courses. Glassdoor and todo notes.

This commit is contained in:
Norm Rasmussen
2024-03-11 17:03:07 -04:00
parent a3455a720c
commit 6576919ff6
6 changed files with 126 additions and 18 deletions

View File

@ -4,7 +4,7 @@ import pprint
import csv
pp = pprint.PrettyPrinter(indent=4)
APIKEY = Apikeys.CIN7
APIKEY = Apikeys.WALMARTPROD
HEADERS = {
"accept": "application/json",
"X-Api-Key": APIKEY,
@ -22,7 +22,7 @@ def get_courses():
# 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/?limit=100&page={count}"
response = requests.get(url, headers=HEADERS)
response = response.json()
nextlink = response["links"]
@ -31,9 +31,9 @@ def get_courses():
status = item['attributes']['status']
if status == 'live':
name = item['attributes']['name']
if "[Core]" in name:
idict = {item["attributes"]["name"]: item["id"]}
list_of_ids.append(idict)
idict = {item["attributes"]["name"]: item["id"]}
list_of_ids.append(idict)
# if "[Core]" in name:
if "next" not in nextlink:
break
@ -41,7 +41,7 @@ def get_courses():
pp.pprint(list_of_ids)
# print(len(list_of_ids))
with open(
"/Users/normrasmussen/Downloads/Cin7-Courses.csv", "a+", newline='\n'
"/Users/normrasmussen/Downloads/Walmart-Live-Courses.csv", "a+", newline='\n'
) as csvfile:
for group in list_of_ids:
for key, value in group.items():