canvasapp/main.py

142 lines
4.6 KiB
Python

"""
Main entry point for Gavilan Canvas Tools App.
"""
#import datetime
from HTMLParser import HTMLParseError
from bs4 import BeautifulSoup as bs
from bs4 import Comment
from collections import defaultdict
from datetime import date
from datetime import datetime
from datetime import timedelta
from dateutil import parser
from dateutil import tz
from itertools import groupby
from sets import Set
from time import strptime, mktime
import base64
import codecs
import collections
import csv
import gzip
import hashlib
import hmac
import html
import htmlentitydefs
import html2markdown as h2m
import imghdr
import isoweek
import json
import math
import numpy as np
import os
import sys
import glob
import pandas as pd
import pdb
import pysftp
import pytz
import re
import requests
import shutil
import sqlite3
import subprocess
import time
import urllib
import webbrowser
import xlwt
import checker
from pipelines import *
from stats import *
from users import *
from util import *
from courses import *
from tasks import *
from outcomes import *
from content import *
#from upload_to_web import put_file
if __name__ == "__main__":
print ("")
options = {
# Basic info & random questions
39:['List all terms', getTerms],
1: ['Current Activity',getCurrentActivity] ,
3: ['List Course Info', getCourses] ,
5: ['List users in a course', getUsersInCourse] ,
8: ['List courses in a term', getCoursesInTerm] ,
12:['Get current classes', class_logs],
13:['Logs for one user', user_logs],
14:['Recent logins, last 5 min', recent_logins],
# User tracking
#4: ['List all users with a gavilan.edu address (employees)', getTeacherRoles] ,
27:['Grades summary of a semester', grades_rundown] ,
30:['List inactive teachers in term', getInactiveTeachersInTerm] ,
6: ['List all teachers', getAllTeachers] ,
15:['All teachers in a term',getAllTeachersInTerm],
16:['Make log of teacher activity',teacherActivityLog],
# Sched or Semester info
#17:['Construct schedule from html file',constructSchedule],
18:['List late-start classes',list_latestarts], ###
19:['External tools',externaltool],
# Tasks
9: ['Upload a photo', uploadPhoto],
10:['Download new photos', downloadPhoto],
11:['Check for avatar',checkForAvatar],
25:['X-List 190 sections', xlist_cwe] , ###
28:['Check accessibility of a course', accessible_check] ,
29:['Switch enrollments of a shell to all teachers', switch_enrol] ,
35:['Enroll user to all active courses in a semester', enroll_accred],
36:['Fix an older course so it can be enrolled again, add accred', unrestrict_course],
38:['Modify external tool', modify_x_tool],
# Post semester
2: ['Positive Attendance Report', pos_atten] ,
26:['20/60 hours calculation', hours_calc] ,
# Outcomes
20:['List outcomes and groups at account level',outcome_groups],
21:['Get outcome results',outcome_report2],
22:['List outcomes attached to classes', outcomes_attached_to_courses] ,
23:['Read the SLOs local file', read_slo_source] ,
24:['Outcome overview and sync', outcome_overview] ,
# Content editing or pulling
31:['Auto update a canvas page to remove fancy html', update_page] ,
32:['Download a courses pages for offline updating', grab_course_pages] ,
33:['Upload course pages back to a class', put_course_pages],
34:['Swap course youtube embeds', swap_youtube_subtitles],
37:['Test the iframe swap', test_swap],
}
for key in options:
print str(key) + '.\t' + options[key][0]
resp = raw_input('\nChoose: ')
results = []
results_dict = {}
# Call the function in the options dict
x = options[ int(resp)][1]()