Reorged notes, ready for the next step. Glassdoor notes. Some small script changes.
This commit is contained in:
@ -2,7 +2,7 @@ import requests
|
||||
import pandas as pd
|
||||
import Apikeys
|
||||
|
||||
apiKey = Apikeys.terminus_employee
|
||||
apiKey = Apikeys.walmartprod
|
||||
course_dict = {}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ def get_course():
|
||||
|
||||
while True:
|
||||
count += 1
|
||||
url = f"https://api.northpass.com/v2/courses?page={count}"
|
||||
url = f"https://api2.northpass.com/v2/courses?page={count}"
|
||||
print(url)
|
||||
headers = {"accept": "application/json", "X-Api-Key": apiKey}
|
||||
response = requests.get(url, headers=headers)
|
||||
@ -23,7 +23,7 @@ def get_course():
|
||||
status = response["attributes"]["status"]
|
||||
uuid = response["id"]
|
||||
name = response["attributes"]["name"]
|
||||
build_url = response["links"]["builder"]["href"]
|
||||
# build_url = response["links"]["builder"]["href"]
|
||||
course_dict = {
|
||||
"id": uuid,
|
||||
"name": name,
|
||||
@ -49,7 +49,7 @@ def get_cat_name(cat_id, course_dict, courses):
|
||||
pass
|
||||
elif len(cat_id) == 1:
|
||||
categoryid = cat_id[0]["id"]
|
||||
url = f"https://api.northpass.com/v2/categories/{categoryid}"
|
||||
url = f"https://api2.northpass.com/v2/categories/{categoryid}"
|
||||
cat_resp = requests.get(url, headers=headers)
|
||||
cat_data = cat_resp.json()
|
||||
cat_name = cat_data["data"]["attributes"]["name"]
|
||||
@ -59,7 +59,7 @@ def get_cat_name(cat_id, course_dict, courses):
|
||||
else:
|
||||
for item in cat_id:
|
||||
categoryid = item["id"]
|
||||
url = f"https://api.northpass.com/v2/categories/{categoryid}"
|
||||
url = f"https://api2.northpass.com/v2/categories/{categoryid}"
|
||||
cat_resp = requests.get(url, headers=headers)
|
||||
cat_data = cat_resp.json()
|
||||
cat_name = cat_data["data"]["attributes"]["name"]
|
||||
@ -76,7 +76,7 @@ def get_cat_name(cat_id, course_dict, courses):
|
||||
|
||||
def write_to_csv(courses):
|
||||
df = pd.DataFrame.from_dict(courses)
|
||||
df.to_csv("/Users/normrasmussen/Downloads/terminus_courses.csv")
|
||||
df.to_csv("/Users/normrasmussen/Downloads/walmart_course.csv")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -6,7 +6,6 @@ from datetime import date
|
||||
|
||||
currentdir = "/Users/normrasmussen/Documents/Work/Scripts/Auto_Scrape_Screenshots/"
|
||||
|
||||
|
||||
def find_pictures(currentdir):
|
||||
files = []
|
||||
listfiles = glob.glob(currentdir + "*.png")
|
||||
|
||||
BIN
Scripts/Backup_Notes_Scripts/.DS_Store
vendored
Normal file
BIN
Scripts/Backup_Notes_Scripts/.DS_Store
vendored
Normal file
Binary file not shown.
21
Scripts/Backup_Notes_Scripts/reorg_notes.py
Normal file
21
Scripts/Backup_Notes_Scripts/reorg_notes.py
Normal file
@ -0,0 +1,21 @@
|
||||
from pathlib import Path
|
||||
|
||||
currentdir = "/Users/normrasmussen/Documents/Work/CustomerNotes/"
|
||||
path_dir = Path("/Users/normrasmussen/Documents/Work/CustomerNotes/")
|
||||
|
||||
def path_files(path_dir):
|
||||
listfiles = list(path_dir.glob("**/*.md"))
|
||||
print(f"Successfully made the '{path_dir}' directory.")
|
||||
for file in listfiles:
|
||||
strfile = str(file)
|
||||
company = strfile.split("/")[6][:-3]
|
||||
new_dir = path_dir / company
|
||||
new_dir.mkdir()
|
||||
file.rename(
|
||||
f"/Users/normrasmussen/Documents/Work/CustomerNotes/{company}/{company}.md"
|
||||
)
|
||||
print(company)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
path_files(path_dir)
|
||||
Reference in New Issue
Block a user