G2 templates, question mark and accredible scripts. HackerRank notes.

This commit is contained in:
Norm Rasmussen
2023-06-08 16:53:46 -04:00
parent 20ef5dab44
commit b5a86e1abb
8 changed files with 247 additions and 63 deletions

View File

@ -1,15 +1,57 @@
import requests
url = "https://api.accredible.com/v1/credentials"
# POST
attributes = {
# id: this can be any string. perhaps we set it to an email for easy ref?
recipient.name: "{{ learner.name }}",
recipient.email: "{{ learner.email }}",
group_id: 461982,
name: "Credential Name",
issued_on: "date",
expired_on: "date",
complete: "bool",
private: "bool",
}
def create_cred():
url = "https://api.accredible.com/v1/credentials"
headers = {
"Content-Type": "application/json",
"Authorization": "Token token=2eb7a23015c751f973ac7db2590bd100",
}
payload = {
"credential": {
"recipient": {
"name": "Norm Test",
"email": "norm+accredtest2@northpass.com",
# "id": "TEST21234",
},
"name": "Skuid Test Credential",
"group_id": 461982,
"issued_on": "07/08/2023",
"expired_on": "07/08/2024",
"complete": True,
"private": True,
},
}
try:
response = requests.post(url, headers=headers, json=payload)
text = response.text
# data = response.json()
print(f"Text Response: {text}")
# print(f"Json Response: {data}")
except TypeError as e:
print(f"Error! It is {e}")
finally:
print("Completed!")
# The public URL lives at: https://www.credential.net/013b920d-b7e6-436a-97ae-245e30f916b6
# Within the payload it is data["credentials"]["url"]
def get_cred():
url = "https://api.accredible.com/v1/issuer/groups/461982"
# url = "https://api.accredible.com/v1/credentials"
headers = {
"Content-Type": "application/json",
"Authorization": "Token token=2eb7a23015c751f973ac7db2590bd100",
}
response = requests.get(url, headers=headers)
text = response.text
# data = response.json()
print(f"Text Response: {text}")
# print(f"Json Response: {data}")
if __name__ == "__main__":
# get_cred()
create_cred()

View File

@ -0,0 +1,23 @@
import requests
def get_results():
url = "https://ondemand.questionmark.com/deliveryodata/406287/Results"
params = "?$filter=ParticipantName eq tom.leggett%40questionmark.com"
# params = "?$filter=AssessmentID eq 352630000352630L"
url_params = f"{url}{params}"
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Basic bm9ydGhwYXNzX2FwaTpobWUycXl4KlRGVSphcHkuZnBr"
}
# response = requests.get(url, headers=headers)
response = requests.get(url_params, headers=headers)
print(response)
print(response.text)
if __name__ == "__main__":
get_results()