mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-16 02:10:19 -04:00
chrome-driver
This commit is contained in:
parent
a85de65880
commit
110cb613b8
|
@ -1,2 +1,15 @@
|
|||
Command Line Interface
|
||||
=====================
|
||||
=====================
|
||||
|
||||
1. Making a user:
|
||||
-------
|
||||
|
||||
python skoolos.py
|
||||
|
||||
You will be redirected to a login page for the SkoolOS website. If you have already created an account on the website, enter login informatiton. If not, select
|
||||
the registration button bellow and create an account. Once you create an account via Ion OAuth and SkoolOS, login. The window should close, prompting:
|
||||
|
||||
Enter SkoolOS Username:
|
||||
Enter SkoolOS Password:
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
Installation
|
||||
============
|
||||
|
||||
1. Git clone repository:
|
||||
Git clone repository:
|
||||
-------
|
||||
|
||||
https://gitlab.tjhsst.edu/understudyathon-2020/group-1/schoolos.git
|
||||
|
||||
2. Install repository and create env
|
||||
Install repository and create env
|
||||
-------
|
||||
|
||||
cd SkoolOS
|
||||
python3 -m venv env
|
||||
|
|
84
skoolos.py
84
skoolos.py
|
@ -53,41 +53,40 @@ def main():
|
|||
input("Welcome to SkoolOS. Press any key to create an account")
|
||||
# webbrowser.open("http://127.0.0.1:8000/login", new=2)
|
||||
authenticate()
|
||||
profiles = os.listdir()
|
||||
users = []
|
||||
info = []
|
||||
count = 1
|
||||
for i in range(len(profiles)):
|
||||
p = profiles[i]
|
||||
if 'profile' in p:
|
||||
f = open(p, 'r')
|
||||
d = json.loads(f.read())
|
||||
f.close()
|
||||
info.append(d)
|
||||
users.append(str(count) + ") " + d['username'])
|
||||
count = count + 1
|
||||
users.append(str(count) + ") Make new user")
|
||||
user = [
|
||||
{
|
||||
'type': 'list',
|
||||
'name': 'user',
|
||||
'choices': users,
|
||||
'message': 'Select User: ',
|
||||
},
|
||||
]
|
||||
u = int(prompt(user)['user'].split(")")[0]) - 1
|
||||
if u + 1 == count:
|
||||
authenticate()
|
||||
return
|
||||
data = info[u]
|
||||
PWD = data['password']
|
||||
USER = data['username']
|
||||
print(data['username'])
|
||||
if data['is_student']:
|
||||
studentCLI(USER, PWD)
|
||||
else:
|
||||
profiles = os.listdir()
|
||||
users = []
|
||||
info = []
|
||||
count = 1
|
||||
for i in range(len(profiles)):
|
||||
p = profiles[i]
|
||||
if 'profile' in p:
|
||||
f = open(p, 'r')
|
||||
d = json.loads(f.read())
|
||||
f.close()
|
||||
info.append(d)
|
||||
users.append(str(count) + ") " + d['username'])
|
||||
count = count + 1
|
||||
users.append(str(count) + ") Make new user")
|
||||
user = [
|
||||
{
|
||||
'type': 'list',
|
||||
'name': 'user',
|
||||
'choices': users,
|
||||
'message': 'Select User: ',
|
||||
},
|
||||
]
|
||||
u = int(prompt(user)['user'].split(")")[0]) - 1
|
||||
if u + 1 == count:
|
||||
authenticate()
|
||||
return
|
||||
data = info[u]
|
||||
PWD = data['password']
|
||||
USER = data['username']
|
||||
print(data['username'])
|
||||
if data['is_student']:
|
||||
studentCLI(USER, PWD)
|
||||
else:
|
||||
teacherCLI(USER, PWD)
|
||||
teacherCLI(USER, PWD)
|
||||
|
||||
|
||||
#################################################################################################### STUDENT METHODS
|
||||
|
@ -591,7 +590,7 @@ def authenticate():
|
|||
"""
|
||||
oauth = OAuth2Session(client_id=client_id, redirect_uri=redirect_uri, scope=scope)
|
||||
authorization_url, state = oauth.authorization_url("https://ion.tjhsst.edu/oauth/authorize/")
|
||||
|
||||
import os
|
||||
cdir = os.getcwd()
|
||||
# Linux: chromdriver-linux
|
||||
# Macos: chromdriver-mac
|
||||
|
@ -599,18 +598,15 @@ def authenticate():
|
|||
print("OS: ")
|
||||
print("MacOS")
|
||||
print("Linux")
|
||||
print("Windows")
|
||||
|
||||
os = input("Enter OS: ")
|
||||
while(os != "Windows" or os != "Linux" or os != "Macos"):
|
||||
system = input("Enter OS: ")
|
||||
while(system.lower() != "Linux" and system.lower() != "macos"):
|
||||
print("Not valid OS")
|
||||
os = input("Enter OS: ")
|
||||
if(os == 'Windows'):
|
||||
path = os.path.join(os.getcwd(), 'chromedriver', 'chromedriver.exe')
|
||||
if(os == 'MacOS'):
|
||||
path = os.path.join(os.getcwd(), 'chromedriver', 'chromedriver-linux')
|
||||
if(os == 'Linux'):
|
||||
system = input("Enter OS: ")
|
||||
if(system.lower() == 'macos'):
|
||||
path = os.path.join(os.getcwd(), 'chromedriver', 'chromedriver-mac')
|
||||
if(system.lower() == 'linux'):
|
||||
path = os.path.join(os.getcwd(), 'chromedriver', 'chromedriver-linux')
|
||||
|
||||
browser = webdriver.Chrome(path)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user