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:
@ -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():
|
||||
|
||||
Reference in New Issue
Block a user