DouglasElliman & other scripts

This commit is contained in:
Norm Rasmussen
2022-11-08 14:47:53 -05:00
parent fce96a5ea6
commit 22704920d8
14 changed files with 2286 additions and 35 deletions

View File

@ -137,7 +137,7 @@ Other Hot topics in the Netherlands:
* Needs info on events
* Upcoming on the global level
## 9/22/2022
## 09/22/2022
* Banner Width smaller
* Mobile view search bar becomes too short - Phone view
* Chevron Carousel is okay for many courses
@ -174,7 +174,26 @@ These are new notes to test an update function
* Item 4
* Item Item
|----
## 11/07/2022
### Meeting Heading: Topics for discussion
* This is an item
* This is another item
* Here are some things that need to be done:
* Item 1
* Item 2
* Item 3
* Discussion points
* More discussion points
### New Heading
This is more text
This is yet again more text but longer
* To do item
* To Three item
## Tasks
- [X] Need to Hide some courses for an offline assesment
@ -219,3 +238,5 @@ Figma file questions
They need more training and enablement They will follow up for Figma files and setting those up for design
,[Name](2022-10-17_name.md)
notes = notes.read()

View File

@ -1,10 +1,11 @@
import io
from datetime import date
import markdown
from re import search
import re
# import pypandoc and/or panflute
rootdir = "/Users/normrasmussen/Documents/Northpass/CustomerNotes/"
rootdir = "/Users/normrasmussen/Documents/Northpass/Scripts/API_Notes/SampleNotes/"
#meetingstart = "##"
#meetingend = "##"
#rx = r'{}.*?{}'.format(re.escape(meetingstart), re.escape(meetingend))
@ -18,29 +19,26 @@ def findheadings():
headingsarray.append(headings)
print(headingsarray)
def pullnotes():
date1 = "!*!"
#"[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}"
date2 = "!@#"
#"[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}"
#range = r'{}.*?{}'.format(re.escape(date1), re.escape(date2))
with open(rootdir + "G2/G2.md", "r") as myfile:
file = myfile.read()
print(file[file.find(date1)+len(date1):file.rfind(date2)])
#print(chunk)
def pullnotes2():
inRecordingMode = False
file = "rootdir + Talkspace/Talkspace.md"
for line in file:
if not inRecordingMode:
if line.startswith(r'\d+/\d+/\d'):
inRecordingMode = True
elif line.startswith(r'\d+/\d+/\d'):
inRecordingMode = False
else:
yield line
# From StackOverflow:
def noteSections(rootdir):
today = date.today()
today = today.strftime("%m/%d/%Y")
dateregex = "^[0-9]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}$"
with open(rootdir+"Flink.md", "r") as f:
notes_flag = False
notes = ''
for line in f:
if line.startswith(f"## {today}"):
notes_flag = True
elif notes_flag:
notes += line
if not line.strip(): break
mdConvert(rootdir, notes)
def mdConvert(rootdir, notes):
conversion = markdown.markdown(notes)
print(notes)
if __name__ == "__main__":
pullnotes()
noteSections(rootdir)

View File

@ -0,0 +1,100 @@
import requests
apiKey = "Bknf8kidbluRfcKu3m3lKoxS8"
groups = [
"Armonk",
"Babylon",
"Bayside",
"Bedford",
"Cutchogue",
"East Hampton",
"East Setauket",
"Executive",
"Farmingville",
"Franklin Square",
"Garden City",
"Great Neck",
"Greenport",
"Hampton Bays",
"Hamptons",
"Huntington",
"Huntington Station",
"Katonah",
"Locust Valley",
"Long Beach",
"Long Island",
"Long Island City",
"Manhasset",
"Manhattan",
"Massapequa Park",
"Mattituck",
"Merrick",
"Montauk",
"New Hyde Park",
"New York",
"North Fork",
"Ocean Beach",
"Plainview",
"Port Washington",
"Queens",
"Quogue",
"Rockville Centre",
"Roslyn",
"Sag Harbor",
"Sayville",
"Scarsdale",
"Sea Cliff",
"Smithtown",
"Southampton",
"Syosset",
"Westchester",
"Westhampton Beach"
]
def findgroupIDs(apiKey, groups):
groupuuids = []
badGroups = []
for group in groups:
url = "https://api.northpass.com/v2/groups?filter[name][eq]="
headers = {
"accept": "application/json",
"X-Api-Key": apiKey
}
response = requests.get(url + group, headers=headers)
response = response.json()
try:
response = response["data"][0]["id"]
groupuuids.append(response)
except:
badGroups.append(group)
finally:
pass
#print(badGroups)
#print(groupuuids)
assignCourse(apiKey,url, groupuuids)
def assignCourse(apiKey, url, groupuuids):
for group in groupuuids:
try:
url = f"https://api.northpass.com/v2/groups/{group}/relationships/courses"
courseuuid = "10e9b174-cbad-4caa-b0ff-1a7338f2345a"
headers = {
"accept": "application/json",
"content-type": "application/json",
"X-Api-Key": apiKey
}
payload = {"data": [
{
"type": "courses",
"id": courseuuid
}
]}
print(f"Group {group} successfully accepted the course")
response = requests.post(url, json=payload, headers=headers)
except:
print(f"Group {group} does not have that course, yet")
finally:
pass
if __name__ == "__main__":
findgroupIDs(apiKey, groups)

View File

@ -0,0 +1,39 @@
import requests
baseUrlname = "https://api.northpass.com/v2/people?filter[name][eq]="
baseUrlemail = "https://api.northpass.com/v2/people?filter[email][eq]="
apiKey = "JRDpCGQ7vSRiva6t5OkWDr5eJ" #This is for G2
def getfromName(baseUrlname, apiKey):
name = "Adam Nelson"
url = baseUrlname + f"{name}"
headers = {
"accept": "*/*",
"x-api-key": apiKey,
"content-type": "application/json",
}
response = requests.get(url, headers=headers)
response = response.json()
print(response)
uuid = response["data"][0]["id"]
print("Learner ID:" )
print(uuid)
def getfromEmail(baseUrlemail, apiKey):
email = "norm+g2test@northpass.com"
#email = "aaron.rodgers@corpay.com"
url = baseUrlemail + f"{email}"
headers = {
"accept": "*/*",
"x-api-key": apiKey,
"content-type": "application/json",
}
response = requests.get(url, headers=headers)
response = response.json()
print(response)
uuid = response["data"][0]["id"]
print("Learner ID:" )
if __name__ == "__main__":
getfromEmail(baseUrlemail, apiKey)
#getfromName(baseUrl, apiKey)

View File

@ -0,0 +1,51 @@
import requests
import os
from datetime import date
import pandas as pd
basecsv = "/Users/normrasmussen/Documents/Northpass/Scripts/G2_Unenroll/g2mca.csv"
def mainFunc(basecsv):
readData = pd.read_csv(
basecsv,
index_col=False,
)
try:
readData.loc[
readData['Course Name'].isin(['G2 Profile Anatomy'])]
try:
readData.loc[
readData['Course Name'].isin('Profile Performance & Lead Management')]
except:
print("Profile Course Failed")
try:
readData.loc[
readData['Course Name'].isin('Review Tracking & Brand Building')]
except:
print("Review Course Failed")
try:
readData.loc[
readData['Course Name'].isin('The Review Rundown')]
extractedList = readData.loc[
readData['Attempt Start'].isnull(),
'Learner Name'].tolist()
print(extractedList)
except:
print("Review Rundown failed")
# newList = [*set(extractedList)]
#findUuids(newList, readData)
except:
print("Not Working")
#def findUuids(newList, readData):
# try:
# for name in newList:
# uuidList = readData.loc[
# readData['Learner Name'] == name),
# 'uuid'.tolist()]
# print(uuidList)
# except:
# print("An error occured")
if __name__ == "__main__":
mainFunc(basecsv)

File diff suppressed because it is too large Load Diff