Cleaned up some files. Anthology and Datasnipper notes. A few script updates.
This commit is contained in:
@ -4,7 +4,7 @@ import pprint
|
||||
import csv
|
||||
|
||||
pp = pprint.PrettyPrinter(indent=4)
|
||||
APIKEY = Apikeys.SPS
|
||||
APIKEY = Apikeys.CIN7
|
||||
HEADERS = {
|
||||
"accept": "application/json",
|
||||
"X-Api-Key": APIKEY,
|
||||
@ -28,14 +28,12 @@ def get_courses():
|
||||
nextlink = response["links"]
|
||||
|
||||
for item in response["data"]:
|
||||
status = item ['attributes']['status']
|
||||
status = item['attributes']['status']
|
||||
if status == 'live':
|
||||
cname = item['attributes']['name']
|
||||
# print(item["id"])
|
||||
idict = {item["attributes"]["name"]: item["id"]}
|
||||
# id = item["id"]
|
||||
# name = item["attributes"]["name"]
|
||||
list_of_ids.append(idict)
|
||||
name = item['attributes']['name']
|
||||
if "[Core]" in name:
|
||||
idict = {item["attributes"]["name"]: item["id"]}
|
||||
list_of_ids.append(idict)
|
||||
|
||||
if "next" not in nextlink:
|
||||
break
|
||||
@ -43,7 +41,7 @@ def get_courses():
|
||||
pp.pprint(list_of_ids)
|
||||
# print(len(list_of_ids))
|
||||
with open(
|
||||
"/Users/normrasmussen/Downloads/SPS-Courses.csv", "a+", newline='\n'
|
||||
"/Users/normrasmussen/Downloads/Cin7-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