Added install documentation to readme.md
Fixed problem with stringOutputs not existing
This commit is contained in:
parent
8ebfcaa8bc
commit
b33f047d12
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,5 @@
|
|||||||
*~*
|
*~*
|
||||||
*.pyc
|
*.pyc
|
||||||
stringOutputs
|
stringOutputs/*
|
||||||
token.json
|
token.json
|
||||||
*.notes
|
*.notes
|
Binary file not shown.
39
README.md
39
README.md
@ -1,3 +1,42 @@
|
|||||||
# Substitution-Requests
|
# Substitution-Requests
|
||||||
|
|
||||||
System for CSE 102 staff to request subs.
|
System for CSE 102 staff to request subs.
|
||||||
|
|
||||||
|
***Installing and configuring for the first time:***
|
||||||
|
|
||||||
|
Install the libraries in your Python environment:
|
||||||
|
|
||||||
|
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
|
||||||
|
pip install --upgrade pandas
|
||||||
|
pip install --upgrade pysimplegui
|
||||||
|
|
||||||
|
Versions that are proven to work (newer versions probably work, older versions maybe work)
|
||||||
|
Pysimplegui 4.60.4
|
||||||
|
pandas: 1.4.4
|
||||||
|
google-api-python-client 2.100.0
|
||||||
|
google-auth-httplib2 0.1.1
|
||||||
|
google-auth-oauthlib 0.5.2
|
||||||
|
|
||||||
|
Install Git
|
||||||
|
https://git-scm.com/downloads
|
||||||
|
Be sure to use the right version (32 vs 64 bit, Windows vs Linux, etc.) you can find your version of Windows by typing “about” in the start bar
|
||||||
|
When installing Git, there are many settings, if you don’t know what it does, just keep the default option.
|
||||||
|
|
||||||
|
Run Git bash and within run this command:
|
||||||
|
git config --global core.autocrlf false
|
||||||
|
|
||||||
|
Close Git bash and open Git Gui
|
||||||
|
Click “Clone Existing Repository” and paste https://git.egr.msu.edu/CSE102/Substitution-Requests.git into the “Source Location” box.
|
||||||
|
The “Target Directory” box is the path to the folder you want to store your local copy in. The folder must NOT already exist.
|
||||||
|
E.g. “C:\Users\USERNAME\Substitution-Requests” will create the Substitution Requests folder and put all the files inside it.
|
||||||
|
Open the Repo in GitGui (this might happen automatically after cloning). Click “Tools” and “Add”
|
||||||
|
Put “Pull” in the name box and “git pull origin master” (no quotes) in the command box and click “Add”
|
||||||
|
|
||||||
|
Run the code for the first time (or since 7 days have elapsed since this step was last performed on this computer)
|
||||||
|
It will take you to a login page, you MUST log in as cse102msu@gmail.com (password is python_1107)
|
||||||
|
This login has mandatory 2-factor authentication (b/c of Google policy on API access)
|
||||||
|
So if this is the first time or if you've reset your browser cookies it will call the office phone in EGR 1107 to give you the code
|
||||||
|
Once logged in, just click continue on each increasingly dire warning page until it says “The authentication flow has completed. You may close this window”
|
||||||
|
|
||||||
|
|
||||||
|
***Workflow:***
|
@ -271,23 +271,23 @@ def getNumFulfilledInDateRange(subRequestsArchiveFilename,earlyDate,lateDate):
|
|||||||
def createStrings():
|
def createStrings():
|
||||||
stfD = pd.read_csv(staffDatabaseFilename,dtype=str,index_col=False)
|
stfD = pd.read_csv(staffDatabaseFilename,dtype=str,index_col=False)
|
||||||
secD = pd.read_csv(sectionDatabaseFilename,dtype=str,index_col=False)
|
secD = pd.read_csv(sectionDatabaseFilename,dtype=str,index_col=False)
|
||||||
with open("stringOutputs/staffIDs.txt",'w') as f:
|
with open("stringOutputs/staffIDs.txt",'w+') as f:
|
||||||
netIDs=stfD['NetID'].values
|
netIDs=stfD['NetID'].values
|
||||||
netIDs.sort()
|
netIDs.sort()
|
||||||
f.write('\n'.join(netIDs))
|
f.write('\n'.join(netIDs))
|
||||||
|
|
||||||
with open("stringOutputs/emails.txt",'w') as f:
|
with open("stringOutputs/emails.txt",'w+') as f:
|
||||||
vals=cp.deepcopy(stfD['NetID'].values)
|
vals=cp.deepcopy(stfD['NetID'].values)
|
||||||
for i in range(len(vals)):
|
for i in range(len(vals)):
|
||||||
vals[i]=vals[i]+"@msu.edu"
|
vals[i]=vals[i]+"@msu.edu"
|
||||||
f.write('; '.join(vals))
|
f.write('; '.join(vals))
|
||||||
|
|
||||||
with open("stringOutputs/sectionTitles.txt",'w') as f:
|
with open("stringOutputs/sectionTitles.txt",'w+') as f:
|
||||||
vals=secD['Section'].values
|
vals=secD['Section'].values
|
||||||
seen=set()
|
seen=set()
|
||||||
f.write('\n'.join([x for x in vals if not (x in seen or seen.add(x))]))
|
f.write('\n'.join([x for x in vals if not (x in seen or seen.add(x))]))
|
||||||
|
|
||||||
with open("stringOutputs/periodDates.txt",'w') as f:
|
with open("stringOutputs/periodDates.txt",'w+') as f:
|
||||||
vals=secD['Date'].values
|
vals=secD['Date'].values
|
||||||
seen=set()
|
seen=set()
|
||||||
f.write('\n'.join([x for x in vals if not (x in seen or seen.add(x))]))
|
f.write('\n'.join([x for x in vals if not (x in seen or seen.add(x))]))
|
||||||
@ -486,7 +486,7 @@ def getForms(subRequestsFilename):
|
|||||||
flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
|
flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
|
||||||
creds = flow.run_local_server(port=0)
|
creds = flow.run_local_server(port=0)
|
||||||
#Save the credentials for the next run
|
#Save the credentials for the next run
|
||||||
with open('token.json', 'w') as token:
|
with open('token.json', 'w+') as token:
|
||||||
token.write(creds.to_json())
|
token.write(creds.to_json())
|
||||||
|
|
||||||
#service = discovery.build('forms', 'v1', http=creds.authorize(Http()), discoveryServiceUrl=DISCOVERY_DOC, static_discovery=False)
|
#service = discovery.build('forms', 'v1', http=creds.authorize(Http()), discoveryServiceUrl=DISCOVERY_DOC, static_discovery=False)
|
||||||
@ -548,5 +548,5 @@ def getForms(subRequestsFilename):
|
|||||||
#Write the updated request list to file
|
#Write the updated request list to file
|
||||||
subs.to_csv(subRequestsFilename,index=False,index_label=False)
|
subs.to_csv(subRequestsFilename,index=False,index_label=False)
|
||||||
#Write the timestamp to the token for checking when this function was last run
|
#Write the timestamp to the token for checking when this function was last run
|
||||||
with open("lastUpdatedToken.txt",'w') as f:
|
with open("lastUpdatedToken.txt",'w+') as f:
|
||||||
f.write(str(datetime.now()))
|
f.write(str(datetime.now()))
|
||||||
|
@ -1 +1 @@
|
|||||||
2023-10-25 11:42:15.835048
|
2023-10-25 12:30:36.615443
|
Loading…
x
Reference in New Issue
Block a user