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
051ecfd6
Commit
051ecfd6
authored
Oct 27, 2021
by
Kevin Lin
✨
Browse files
Add get_groups_ohyay.py
parent
454ef84c
Changes
1
Hide whitespace changes
Inline
Side-by-side
get_groups_ohyay.py
0 → 100755
View file @
051ecfd6
#!/usr/bin/env python3
import
csv
,
os
import
canvas_api
import
os.path
import
readline
if
__name__
==
"__main__"
:
token
=
os
.
getenv
(
"TOKEN"
)
if
not
token
:
token
=
input
(
"Enter a Canvas token (https://canvas.uw.edu/profile/settings): "
)
canvas
=
canvas_api
.
Canvas
(
token
)
courses_taught
=
canvas
.
get_courses_taught
()
if
courses_taught
is
None
:
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."
)
exit
(
1
)
groups
=
course
.
get_groups
()
print
(
"Email,Tags"
)
for
group
in
groups
:
for
student
in
groups
[
group
]:
print
(
f
"
{
student
.
uwnetid
}
@uw.edu,
{
group
.
lower
()
}
"
)
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