Canvas and Mastery are experiencing issues due to an ongoing AWS incident. Follow the status at AWS Health Dashboard and Instructure Status Page
Is there a way for me to get a list of teachers for all the classes? I looked into the provisioning reports under settings, but that doesn't seem to do what i am looking for. What I am looking for is a list of courses (which the provisioning reports give me) and their corresponding teacher(s). Do I have to use API to do this?
Thanks in advance.
Solved! Go to Solution.
If you create your enrollments via SIS imports, you can do the "SIS Export" report and have it generate an enrollments CSV. You can filter that CSV by role. The report does not give names, but you can generate the users.csv as well and do some VLOOKUP or INDEX/MATCH magic with Excel to get the names from the user IDs.
If you create your enrollments via SIS imports, you can do the "SIS Export" report and have it generate an enrollments CSV. You can filter that CSV by role. The report does not give names, but you can generate the users.csv as well and do some VLOOKUP or INDEX/MATCH magic with Excel to get the names from the user IDs.
Exactly what I am looking for. Thank you so much!
I just found some Python code that I've used to pull a list of teachers into a CSV file. I'm not quite sure if I actually wrote this or not but I just tested it and it worked. It just asks which account you want to pull from so you supply it with the account ID and it will pull the courses in that account and the teachers associated with each one.
#!/usr/bin/python
import csv, requests, time, json
from pprint import pprint
#########################################
###### Generate List of Teachers ######
#########################################
access_token = 'token here' # access token
teachers_csv = 'teachers.csv' # name of file storing Canvas course IDs (not SIS IDs)
baseUrl = 'https://yourinstitution.instructure.com/api/v1/accounts/' # Canvas domain
header = {'Authorization' : 'Bearer ' + access_token}
payload = {}
def main():
# generate a time stamp
log_time = str(time.asctime(time.localtime(time.time())))
get_courses()
def get_courses():
l = open(teachers_csv, 'w+') # creates a new csv file and overwrites the existing
l.write("course_id, course_name, teacher1, teacher2, teacher3" + "\n")
l.close() #closes the csv so write_to_scores() can append to it.
account_id = raw_input("Enter Account ID:")
url = baseUrl + account_id + '/courses?include[]=teachers'
r = requests.get(url, headers = header, data = payload)
j = json.loads(r.text)
write_rows(j)
while r.links['current']['url'] != r.links['last']['url']:
r = requests.get(r.links['next']['url'], headers=header)
j = json.loads(r.text)
write_rows(j)
def write_rows(j):
count = 0
with open(teachers_csv, 'a') as log:
for course in j:
teachers=j[count]['teachers']
if j[count]['teachers']:
log.write(str(j[count]['id'])+ ',"' + str(j[count]['name'])+ '"')
pprint(str(j[count]['id'])+ ',"' + str(j[count]['name'])+ '"')
for teacher in teachers:
log.write("," + teacher["display_name"])
log.write("\n")
count +=1
if __name__ == "__main__": main()
Many thanks for this reply @MattHanes - Saved an awful lot of time!
I'm really glad to hear that, @GideonWilliams !
To interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.