Skip to content

Cannot print individual courses #604

Answered by bennettscience
chazmorton asked this question in Q&A
Discussion options

You must be logged in to vote

Ah, that makes sense. I knew Canvas would restrict access to courses, but I didn't know it didn't send any information if it was restricted.

I'm pretty sure using the enrollment_state keyword argument will filter out classes you don't have access to any more because of date limits:

canvas = Canvas(API_URL, API_KEY)
user = canvas.get_current_user()
courses = user.get_courses(enrollment_state="active") 
for course in courses:
    print(course)

If that doesn't work, you can try the state="active" argument.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@chazmorton
Comment options

@bennettscience
Comment options

@chazmorton
Comment options

@bennettscience
Comment options

Answer selected by chazmorton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants