New Cin7 templates. Anthology CSV updates.
This commit is contained in:
@ -4,7 +4,7 @@ import json
|
||||
import requests
|
||||
import Apikeys
|
||||
|
||||
APIKEY = Apikeys.DATASNIPPER
|
||||
APIKEY = Apikeys.ANTHOLOGY
|
||||
groups_dict = {}
|
||||
pp = pprint.PrettyPrinter(indent=4)
|
||||
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
import Apikeys
|
||||
import requests
|
||||
import pprint
|
||||
import csv
|
||||
|
||||
APIKEY = Apikeys.RENAISSANCE
|
||||
pp = pprint.PrettyPrinter(indent=4)
|
||||
APIKEY = Apikeys.WALMARTPROD
|
||||
HEADERS = {
|
||||
"accept": "application/json",
|
||||
"X-Api-Key": APIKEY,
|
||||
@ -45,25 +48,30 @@ 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"]
|
||||
|
||||
for item in response["data"]:
|
||||
cname = item['attributes']['name']
|
||||
if "[USCS CH MI]" in cname:
|
||||
print(cname)
|
||||
# print(item["id"])
|
||||
# idict = {item["attributes"]["name"]: item["id"]}
|
||||
idict = {item["attributes"]["name"]: item["id"]}
|
||||
# id = item["id"]
|
||||
# name = item["attributes"]["name"]
|
||||
# list_of_ids.append(idict)
|
||||
list_of_ids.append(idict)
|
||||
|
||||
if "next" not in nextlink:
|
||||
break
|
||||
# print(list_of_ids)
|
||||
pp.pprint(list_of_ids)
|
||||
# print(len(list_of_ids))
|
||||
with open(
|
||||
"/Users/normrasmussen/Downloads/Spark-Courses.csv", "a+", newline='\n'
|
||||
) as csvfile:
|
||||
for group in list_of_ids:
|
||||
for key, value in group.items():
|
||||
csvwriter = csv.writer(csvfile)
|
||||
csvwriter.writerow([key, value])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user