Comments (3)
Hey @sigurdurb,
In the latest release (#52), we added some functionality that should suit your needs.
When getting a course, account, group, or section, you can add an optional parameter use_sis_id
to True
to use the SIS_ID instead of the canvas ID. For example:
canvas = Canvas(API_URL, API_KEY)
# Get a course by Canvas ID
COURSE_ID = 123456
canvas_course = canvas.get_course(COURSE_ID)
# Get a course by SIS ID
SIS_COURSE_ID = 'ENC101'
sis_course = canvas.get_course(SIS_COURSE_ID, use_sis_id=True)
Gonna mark this as closed. Feel free to re-open or make a new issue if you have any other questions!
from canvasapi.
Hi @sigurdurb!
In the current state of the library, this isn't possible yet. However, we have already created a solution to a similar problem for get_user
. In the case of get_user
, you can provide an optional argument called id_type
with values such as 'sis_login_id'
or 'sis_user_id'
, which would be prepended to the id with a colon.
There appears to be several types of objects in Canvas with special ids:
https://canvas.instructure.com/doc/api/file.object_ids.html
Do you think it would be beneficial to apply the solution provided in get_user
to the other objects?
from canvasapi.
My apologies @sigurdurb, I believe my earlier post only addressed part of your question.
To get a list of all users in a course with enrollment type student, you can do the following:
canvas = Canvas(API_URL, API_KEY)
# First, retrieve the Course object
course = canvas.get_course(COURSE_ID)
# Grab all users from a course with the 'student' enrollment type
# Note that students is a PaginatedList object
students = course.get_users(enrollment_type='student')
# Loop through users and do what you need.
for student in students:
print(student)
from canvasapi.
Related Issues (20)
- Missing pagination for search results HOT 3
- Add missing methods to File HOT 1
- QuizSubmission update_score_and_comments doesn't seem to work HOT 3
- New Quizzes
- New Quiz Items
- Docs: How to download/upload grades/Gradebook? HOT 1
- Error when a course access is restricted HOT 1
- canvas create conversation cannot set subject HOT 3
- Rework url structure to accommodate graphql and new quizzes endpoints
- Attach files when creating a new discussion topic
- Delete Group Pages
- Request timeouts
- Comments to submissions are always added to first attempt HOT 1
- Duplicate Assignment
- Include Initiator-Only Conversations in API Endpoint HOT 3
- arrow.ParserError does not exist in file canvas_object.py HOT 8
- File objects get attribute `content-type` which must be accessed through `getattr` HOT 2
- Creating Quiz Questions HOT 1
- Improve `PaginatedList` docs
- setuptools 71 w/ pytest: TypeError: canonicalize_version() unexpected keyword argument 'strip_trailing_zero' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from canvasapi.