Lot's of skuid scripts for accredible and question mark. Some template changes for Mizuno & G2.

This commit is contained in:
Norm Rasmussen
2023-06-09 15:01:46 -04:00
parent b5a86e1abb
commit fb9bd2d954
6 changed files with 153 additions and 89 deletions

View File

@ -1,10 +1,14 @@
import threading
import requests
from datetime import datetime
def get_results():
threading.Timer(5.0, get_results).start()
url = "https://ondemand.questionmark.com/deliveryodata/406287/Results"
params = "?$filter=ParticipantName eq tom.leggett%40questionmark.com"
params = "?$filter=ParticipantName eq 'norm@northpass.com'"
# params = "?$filter=ParticipantName eq 'tom.leggett@questionmark.com'"
# params = "?$filter=AssessmentID eq 352630000352630L"
# Alexa Test 1 AssesmentID = 0346128000346128
url_params = f"{url}{params}"
headers = {
@ -15,8 +19,31 @@ def get_results():
# response = requests.get(url, headers=headers)
response = requests.get(url_params, headers=headers)
print(response)
print(response.text)
data = response.json()
data = data["value"]
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
if data == []:
logfile = open("qm-log.txt", "a") # append mode
logfile.write(f"No Data - {current_time} \n")
logfile.close()
else:
datalist = []
for item in data:
email = item["ParticipantName"]
passval = item["ScoreBandTitle"]
score = item["PercentageScore"]
assesmentid = item["AssessmentID"]
finished = item["WhenFinished"]
datalist = [email, assesmentid, score, passval, finished]
print(datalist)
logfile = open("qm-log.txt", "a") # append mode
logfile.write(str(datalist))
logfile.write(f" - {current_time} \n")
logfile.close()
if __name__ == "__main__":