mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-18 03:10:18 -04:00
hmmm
This commit is contained in:
parent
468e7426cd
commit
7f7fdd1ddb
68
skoolos.py
68
skoolos.py
|
@ -1,6 +1,3 @@
|
||||||
"""
|
|
||||||
The main program file for SkoolOS
|
|
||||||
"""
|
|
||||||
import sys
|
import sys
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import requests
|
import requests
|
||||||
|
@ -97,8 +94,8 @@ def main():
|
||||||
def studentCLI(user, password):
|
def studentCLI(user, password):
|
||||||
"""
|
"""
|
||||||
The CLI for students to access
|
The CLI for students to access
|
||||||
@param user: student username
|
:param user: student username
|
||||||
@param password: student password
|
:param password: student password
|
||||||
"""
|
"""
|
||||||
from CLI import student
|
from CLI import student
|
||||||
data = getUser(user, password, 'student')
|
data = getUser(user, password, 'student')
|
||||||
|
@ -116,7 +113,7 @@ def studentCLI(user, password):
|
||||||
def chooseClassStudent(student):
|
def chooseClassStudent(student):
|
||||||
"""
|
"""
|
||||||
Chooses a class for a student to view and work on
|
Chooses a class for a student to view and work on
|
||||||
@param student: a student
|
:param student: a student
|
||||||
:return: a course prompt
|
:return: a course prompt
|
||||||
"""
|
"""
|
||||||
carray = student.sclass.split(",")
|
carray = student.sclass.split(",")
|
||||||
|
@ -142,8 +139,8 @@ def classOptionsStudent(student, course):
|
||||||
"""
|
"""
|
||||||
Allows students to choose what they want to do related to a class
|
Allows students to choose what they want to do related to a class
|
||||||
The student can save, exit, or go back
|
The student can save, exit, or go back
|
||||||
@param student: a student
|
:param student: a student
|
||||||
@param course: a course
|
:param course: a course
|
||||||
:return: True if exiting, False if going back
|
:return: True if exiting, False if going back
|
||||||
"""
|
"""
|
||||||
student.viewClass(course)
|
student.viewClass(course)
|
||||||
|
@ -175,14 +172,14 @@ def classOptionsStudent(student, course):
|
||||||
tlist = []
|
tlist = []
|
||||||
b = True
|
b = True
|
||||||
for a in assignments:
|
for a in assignments:
|
||||||
oname = a + "_" + course
|
oname = a + "_" + course
|
||||||
a = student.username + "/" + a
|
a = student.username + "/" + a
|
||||||
if(os.path.isdir(a) and not "." in a and not oname in student.completed):
|
if(os.path.isdir(a) and not "." in a and not oname in student.completed):
|
||||||
tlist.append(a)
|
tlist.append(a)
|
||||||
assignments = tlist
|
assignments = tlist
|
||||||
assignments.append("Back")
|
assignments.append("Back")
|
||||||
print(assignments)
|
print(assignments)
|
||||||
|
|
||||||
options = [
|
options = [
|
||||||
{
|
{
|
||||||
'type': 'list',
|
'type': 'list',
|
||||||
|
@ -203,8 +200,8 @@ def classOptionsStudent(student, course):
|
||||||
def teacherCLI(user, password):
|
def teacherCLI(user, password):
|
||||||
"""
|
"""
|
||||||
The CLI for teachers to access
|
The CLI for teachers to access
|
||||||
@param user: teachers username
|
:param user: teachers username
|
||||||
@param password: teachers password
|
:param password: teachers password
|
||||||
"""
|
"""
|
||||||
from CLI import teacher
|
from CLI import teacher
|
||||||
data = getUser(user, password, 'teacher')
|
data = getUser(user, password, 'teacher')
|
||||||
|
@ -422,7 +419,7 @@ def viewStudentsTeacher(teacher, course):
|
||||||
data = getDB(teacher.username, teacher.password, "http://127.0.0.1:8000/api/classes/" + course)
|
data = getDB(teacher.username, teacher.password, "http://127.0.0.1:8000/api/classes/" + course)
|
||||||
students = data["confirmed"]
|
students = data["confirmed"]
|
||||||
unconf = data['unconfirmed']
|
unconf = data['unconfirmed']
|
||||||
print("Studented in class: ")
|
print("Students in class: ")
|
||||||
for s in students:
|
for s in students:
|
||||||
print(s)
|
print(s)
|
||||||
print("Requsted Students: ")
|
print("Requsted Students: ")
|
||||||
|
@ -451,6 +448,7 @@ def viewStudentsTeacher(teacher, course):
|
||||||
s = f.split("_")[0]
|
s = f.split("_")[0]
|
||||||
alist.append(s)
|
alist.append(s)
|
||||||
print("Has submitted: " + str(alist))
|
print("Has submitted: " + str(alist))
|
||||||
|
#Y/N
|
||||||
|
|
||||||
#put log stuff
|
#put log stuff
|
||||||
|
|
||||||
|
@ -460,9 +458,9 @@ def viewStudentsTeacher(teacher, course):
|
||||||
def getUser(ion_user, password, utype):
|
def getUser(ion_user, password, utype):
|
||||||
"""
|
"""
|
||||||
Returns user information
|
Returns user information
|
||||||
@param ion_user: user
|
:param ion_user: user
|
||||||
@param password: user's password
|
:param password: user's password
|
||||||
@param utype: type of user (student or teacher
|
:param utype: type of user (student or teacher
|
||||||
:return: api user information
|
:return: api user information
|
||||||
"""
|
"""
|
||||||
if 'student' in utype:
|
if 'student' in utype:
|
||||||
|
@ -490,10 +488,10 @@ def getUser(ion_user, password, utype):
|
||||||
def patchDB(USER, PWD, url, data):
|
def patchDB(USER, PWD, url, data):
|
||||||
"""
|
"""
|
||||||
Sends a PATCH request to url
|
Sends a PATCH request to url
|
||||||
@param USER: username
|
:param USER: username
|
||||||
@param PWD: password
|
:param PWD: password
|
||||||
@param url: URL for request
|
:param url: URL for request
|
||||||
@param data: data to request
|
:param data: data to request
|
||||||
:return: json request response
|
:return: json request response
|
||||||
"""
|
"""
|
||||||
r = requests.patch(url=url, data=data, auth=(USER, PWD))
|
r = requests.patch(url=url, data=data, auth=(USER, PWD))
|
||||||
|
@ -504,9 +502,9 @@ def patchDB(USER, PWD, url, data):
|
||||||
def getDB(USER, PWD, url):
|
def getDB(USER, PWD, url):
|
||||||
"""
|
"""
|
||||||
Sends a GET request to url
|
Sends a GET request to url
|
||||||
@param USER: username
|
:param USER: username
|
||||||
@param PWD: password
|
:param PWD: password
|
||||||
@param url: URL for request
|
:param url: URL for request
|
||||||
:return: json request response
|
:return: json request response
|
||||||
"""
|
"""
|
||||||
r = requests.get(url=url, auth=(USER, PWD))
|
r = requests.get(url=url, auth=(USER, PWD))
|
||||||
|
@ -517,10 +515,10 @@ def getDB(USER, PWD, url):
|
||||||
def postDB(USER, PWD, url, data):
|
def postDB(USER, PWD, url, data):
|
||||||
"""
|
"""
|
||||||
Sends a POST request to url
|
Sends a POST request to url
|
||||||
@param USER: username
|
:param USER: username
|
||||||
@param PWD: password
|
:param PWD: password
|
||||||
@param url: URL for request
|
:param url: URL for request
|
||||||
@param data: data to request
|
:param data: data to request
|
||||||
:return: json request response
|
:return: json request response
|
||||||
"""
|
"""
|
||||||
r = requests.post(url=url, data=data, auth=(USER, PWD))
|
r = requests.post(url=url, data=data, auth=(USER, PWD))
|
||||||
|
@ -531,10 +529,10 @@ def postDB(USER, PWD, url, data):
|
||||||
def putDB(USER, PWD, url, data):
|
def putDB(USER, PWD, url, data):
|
||||||
"""
|
"""
|
||||||
Sends a PUT request to url
|
Sends a PUT request to url
|
||||||
@param USER: username
|
:param USER: username
|
||||||
@param PWD: password
|
:param PWD: password
|
||||||
@param url: URL for request
|
:param url: URL for request
|
||||||
@param data: data to request
|
:param data: data to request
|
||||||
:return: json request response
|
:return: json request response
|
||||||
"""
|
"""
|
||||||
r = requests.put(url=url, data=data, auth=(USER, PWD))
|
r = requests.put(url=url, data=data, auth=(USER, PWD))
|
||||||
|
@ -545,9 +543,9 @@ def putDB(USER, PWD, url, data):
|
||||||
def delDB(USER, PWD, url):
|
def delDB(USER, PWD, url):
|
||||||
"""
|
"""
|
||||||
Sends a DELETE request to url
|
Sends a DELETE request to url
|
||||||
@param USER: username
|
:param USER: username
|
||||||
@param PWD: password
|
:param PWD: password
|
||||||
@param url: URL for request
|
:param url: URL for request
|
||||||
:return: json request response
|
:return: json request response
|
||||||
"""
|
"""
|
||||||
r = requests.delete(url=url, auth=(USER, PWD))
|
r = requests.delete(url=url, auth=(USER, PWD))
|
||||||
|
@ -610,7 +608,7 @@ def authenticate():
|
||||||
path = os.path.join(os.getcwd(), 'chromedriver', 'chromedriver-mac')
|
path = os.path.join(os.getcwd(), 'chromedriver', 'chromedriver-mac')
|
||||||
if(system.lower() == 'linux'):
|
if(system.lower() == 'linux'):
|
||||||
path = os.path.join(os.getcwd(), 'chromedriver', 'chromedriver-linux')
|
path = os.path.join(os.getcwd(), 'chromedriver', 'chromedriver-linux')
|
||||||
|
|
||||||
browser = webdriver.Chrome(path)
|
browser = webdriver.Chrome(path)
|
||||||
|
|
||||||
browser.get("localhost:8000/login")
|
browser.get("localhost:8000/login")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user