Walmart new script for muiltiple ids (activities, learning paths, courses). Talkspace script to update their workato recipe.
This commit is contained in:
@ -6,8 +6,11 @@ import requests
|
||||
import pandas as pd
|
||||
import Apikeys
|
||||
|
||||
APIKEY = Apikeys.walmartprod
|
||||
|
||||
APIKEY = Apikeys.talkspace_1099
|
||||
COURSES = ["Getting Started at Talkspace (ICP - 2023)",
|
||||
"Getting Started at Talkspace (Prescriber)",
|
||||
"Getting Started at Talkspace (Associate ICP)",
|
||||
"Talkspace Managed Care Plans"]
|
||||
|
||||
def get_course():
|
||||
"""
|
||||
@ -20,8 +23,7 @@ def get_course():
|
||||
|
||||
while True:
|
||||
count += 1
|
||||
url = f"https://api2.northpass.com/v2/courses?page={count}"
|
||||
print(url)
|
||||
url = f"https://api.northpass.com/v2/courses?page={count}"
|
||||
headers = {"accept": "application/json", "X-Api-Key": APIKEY}
|
||||
response = requests.get(url, headers=headers)
|
||||
data = response.json()
|
||||
@ -32,22 +34,25 @@ def get_course():
|
||||
if status == "live":
|
||||
uuid = response["id"]
|
||||
name = response["attributes"]["name"]
|
||||
full_description = response["attributes"]["full_description"]
|
||||
course_dict = {
|
||||
"id": uuid,
|
||||
"name": name,
|
||||
"status": status,
|
||||
"full_description": full_description,
|
||||
}
|
||||
if name in COURSES:
|
||||
# full_description = response["attributes"]["full_description"]
|
||||
course_dict = {
|
||||
"id": uuid,
|
||||
"name": name,
|
||||
# "status": status,
|
||||
# "full_description": full_description,
|
||||
}
|
||||
|
||||
try:
|
||||
courses.append(course_dict)
|
||||
except TypeError as e:
|
||||
print(f"Error: {e}")
|
||||
finally:
|
||||
write_to_csv(courses)
|
||||
else:
|
||||
pass
|
||||
try:
|
||||
courses.append(course_dict)
|
||||
except TypeError as e:
|
||||
print(f"Error: {e}")
|
||||
finally:
|
||||
# write_to_csv(courses)
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
print(courses)
|
||||
|
||||
if "next" not in nextlink:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user