diff --git a/.gitignore b/.gitignore index 55dc7c6..54b9e55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -secrets.py +canvas_secrets.py *.bak .ipynb_checkpoints 104ab42f11 diff --git a/cq_demo.py b/cq_demo.py index 4fb769f..cf3f8d3 100644 --- a/cq_demo.py +++ b/cq_demo.py @@ -1,5 +1,5 @@ import codecs, json, requests -from secrets import cq_token, ph_token +from canvas_secrets import cq_token, ph_token token = cq_token url = 'https://ilearn.gavilan.edu' header = {'Authorization': 'Bearer ' + token} diff --git a/curric2022.py b/curric2022.py index 01918f0..2d29770 100644 --- a/curric2022.py +++ b/curric2022.py @@ -13,7 +13,7 @@ from bs4 import BeautifulSoup as bs leafcount = 0 displaynames = [] -from secrets import cq_user, cq_pasw +from canvas_secrets import cq_user, cq_pasw CQ_URL = "https://secure.curricunet.com/scripts/webservices/generic_meta/clients/versions/v4/gavilan.cfc" diff --git a/curriculum.py b/curriculum.py index db778bb..1ce780d 100644 --- a/curriculum.py +++ b/curriculum.py @@ -13,7 +13,7 @@ import pandas as pd import sys, locale, re from pipelines import getSemesterSchedule -from secrets import cq_url, cq_user, cq_pasw +from canvas_secrets import cq_url, cq_user, cq_pasw #sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout) diff --git a/depricated.py b/depricated.py index 8590302..c8f19c0 100644 --- a/depricated.py +++ b/depricated.py @@ -4,6 +4,36 @@ # from pipelines - canvas data + + +online_courses = {} +def prep_online_courses_df(): + global online_courses + schedule = current_schedule() # from banner + online_courses = schedule[lambda x: x.type=='online'] + +def course_is_online(crn): + global online_courses + #print "looking up: " + str(crn) + #print online_courses + course = online_courses[lambda x: x.crn==int(crn)] + return len(course) + +def get_crn_from_name(name): + #print "name is: " + #print(name) + m = re.search( r'(\d\d\d\d\d)', name) + if m: return int(m.groups(1)[0]) + else: return 0 + +def get_enrlmts_for_user(user,enrollments): + #active enrollments + u_en = enrollments[ lambda x: (x['user_id'] == user) & (x['workflow']=='active') ] + return u_en[['type','course_id']] + + + + """ timestamp = nowAsStr() diff --git a/gpt.py b/gpt.py index 97ebf1e..42dfe0d 100644 --- a/gpt.py +++ b/gpt.py @@ -1,7 +1,7 @@ import os, json, sys import openai -from secrets import openai_org, openai_api_key +from canvas_secrets import openai_org, openai_api_key openai.organization = "org-66WLoZQEtBrO42Z9S8rfd10M" diff --git a/interactive.py b/interactive.py index 1bb445f..33d3413 100644 --- a/interactive.py +++ b/interactive.py @@ -13,7 +13,7 @@ from importlib import reload import server import localcache from server import * -from secrets import flask_secretkey +from canvas_secrets import flask_secretkey q = Queue() diff --git a/pipelines.py b/pipelines.py index fb05f00..0aa8d88 100644 --- a/pipelines.py +++ b/pipelines.py @@ -11,8 +11,8 @@ import sys, shutil, hmac, hashlib, base64, schedule, time, pathlib, datetime import pdb from collections import defaultdict from deepdiff import DeepDiff -from secrets import apiKey, apiSecret, FTP_SITE, FTP_USER, FTP_PW, GOO, GOO_PIN, token, url, domain, account_id, header, g_id, g_secret -from secrets import instructure_url, instructure_username, instructure_private_key +from canvas_secrets import apiKey, apiSecret, FTP_SITE, FTP_USER, FTP_PW, GOO, GOO_PIN, token, url, domain, account_id, header, g_id, g_secret +from canvas_secrets import instructure_url, instructure_username, instructure_private_key @@ -429,32 +429,6 @@ def getSemesterSchedule(short='sp21'): # I used to be current_sch -online_courses = {} -def prep_online_courses_df(): - global online_courses - schedule = current_schedule() # from banner - online_courses = schedule[lambda x: x.type=='online'] - -def course_is_online(crn): - global online_courses - #print "looking up: " + str(crn) - #print online_courses - course = online_courses[lambda x: x.crn==int(crn)] - return len(course) - -def get_crn_from_name(name): - #print "name is: " - #print(name) - m = re.search( r'(\d\d\d\d\d)', name) - if m: return int(m.groups(1)[0]) - else: return 0 - -def get_enrlmts_for_user(user,enrollments): - #active enrollments - u_en = enrollments[ lambda x: (x['user_id'] == user) & (x['workflow']=='active') ] - return u_en[['type','course_id']] - - ################ ################ CANVAS DATA diff --git a/tasks.py b/tasks.py index 611d215..5f8e28b 100644 --- a/tasks.py +++ b/tasks.py @@ -17,7 +17,7 @@ import pysftp, os, datetime, requests, re, json, sqlite3, codecs, csv, sys import funcy, os.path, shutil, urllib from datetime import datetime -from secrets import badgr_target, badgr_hd +from canvas_secrets import badgr_target, badgr_hd if os.name != 'posix': diff --git a/tempget.py b/tempget.py index 79193af..87dbe72 100644 --- a/tempget.py +++ b/tempget.py @@ -11,7 +11,7 @@ import re import time -from secrets import banner_url1, banner_url2, GOO, GOO_PIN, otter_login, otter_pw +from canvas_secrets import banner_url1, banner_url2, GOO, GOO_PIN, otter_login, otter_pw