# get a specific course course = canvas.get_course(COURSE_NUM) print("Selected course: \n", course.name) print() ##################################### # set the title and choose the file # if a file is specified, then use that file print("choosing a file") if len(sys.argv) > 1: file_name = str(sys.argv[1]) print("File chose: ", file_name) title = input("Please enter the title: ") else: title, file_name = _chooseFile.chooseFile(MY_ANNOUNCEMENTS) ##################################### # set the time to post delayed_post = _chooseFile.delayPost() # read in the message from a markdown file os.chdir(MY_ANNOUNCEMENTS) with open(file_name, "r", encoding="utf-8") as input_file: text = input_file.read() message = markdown.markdown(text) post = course.create_discussion_topic(title=title, message=message, discussion_type='threaded', is_announcement=True,
# get a specific course course = canvas.get_course(COURSE_NUM) print("Selected course: \n", course.name) print() ##################################### # set the title and choose the file # if a file is specified, then use that file print("choosing a file") if len(sys.argv) > 1: file_name = str(sys.argv[1]) print("File chose: ", file_name) title = input("Please enter the title: ") else: title, file_name = _chooseFile.chooseFile(MY_ASSIGNMENTS) # read the body from a markdown file with open(file_name, "r", encoding="utf-8") as input_file: text = input_file.read() page_body = markdown.markdown(text) points = input("How many points possible? ") if points == '': points = '5' print('points: ', points) new_assignment = course.create_assignment({ 'name': title, 'description': page_body, 'published': False,
# get a specific course course = canvas.get_course(COURSE_NUM) print("Selected course: \n", course.name) print() ##################################### # set the title and choose the file # if a file is specified, then use that file print("choosing a file") if len(sys.argv) > 1: file_name = str(sys.argv[1]) print("File chose: ", file_name) title = input("Please enter the title: ") else: title, file_name = _chooseFile.chooseFile(MY_PAGES) # read the body from a markdown file with open(file_name, "r", encoding="utf-8") as input_file: text = input_file.read() page_body = markdown.markdown(text) # create the page new_page = course.create_page({ 'title': title, 'body': page_body, 'published': True }) print("Created: ", new_page) #####################################
# get a specific course course = canvas.get_course(COURSE_NUM) print("Selected course: \n", course.name) print() ##################################### # set the title and choose the file # if a file is specified, then use that file print("choosing a file") if len(sys.argv) > 1: file_name = str(sys.argv[1]) print("File chose: ", file_name) title = input("Please enter the title: ") else: title, file_name = _chooseFile.chooseFile(MY_DISCUSSIONS) os.chdir(MY_DISCUSSIONS) with open(file_name, "r", encoding="utf-8") as input_file: text = input_file.read() message = markdown.markdown(text) points = input("How many points possible? ") if points == '': points = '1' print('points: ', points) post = course.create_discussion_topic( title=title, message=message, published=False,