Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kevin Lin
canvas-groups
Commits
12147e88
Commit
12147e88
authored
Oct 06, 2020
by
Kevin Lin
✨
Browse files
get_groups_zoom.py: Remove dependency on config file
parent
16579d44
Changes
1
Hide whitespace changes
Inline
Side-by-side
get_groups_zoom.py
View file @
12147e88
...
...
@@ -5,15 +5,10 @@ import canvas_api
import
os.path
import
readline
from
config
import
token_file
,
course_id
if
__name__
==
"__main__"
:
if
not
os
.
path
.
isfile
(
token_file
):
token
=
input
(
"Enter a Canvas Token (https://canvas.uw.edu/profile/settings): "
)
with
open
(
token_file
,
'w'
)
as
f
:
f
.
write
(
token
)
token
=
open
(
token_file
,
'r'
).
read
().
strip
(
"
\n\t
"
)
token
=
os
.
getenv
(
"TOKEN"
)
if
not
token
:
token
=
input
(
"Enter a Canvas token (https://canvas.uw.edu/profile/settings): "
)
canvas
=
canvas_api
.
Canvas
(
token
)
...
...
@@ -22,6 +17,10 @@ if __name__ == "__main__":
print
(
"Invalid Canvas token."
)
exit
(
1
)
course_id
=
os
.
getenv
(
"COURSE_ID"
)
if
not
course_id
:
course_id
=
input
(
"Enter a Canvas course ID (URL slug): "
)
course
=
canvas
.
get_course
(
course_id
)
if
course
is
None
:
print
(
"Invalid Canvas course."
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment