We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We would like to use the API client to unenroll a user from a course in edX
The text was updated successfully, but these errors were encountered:
During some local testing a while back, I ended up using the un-enrollment endpoint directly via HTTP. Here is a snippet of that code:
### Enroll via HTTP API usernames = ['honor', 'audit', 'staff'] pw = 'edx' course_id_str = 'course-v1:MIT+gsidebo000+2017_Summer' enroll_url = '/change_enrollment' # from django.contrib.auth.models import User from django.test.client import Client def set_enrollment(course_id_str, usernames, pw, enroll=True): client = Client() enroll_url = '/change_enrollment' for username in usernames: login_resp = client.post( '/user_api/v1/account/login_session/', data={ "email": "{}@example.com".format(username), "password": pw, "remember": "false" }, headers={ 'Referer': '/login', }, ) enrollment_action = 'enroll' if enroll else 'unenroll' resp = client.post(enroll_url, data={'course_id': course_id_str, 'enrollment_action': enrollment_action})
Sorry, something went wrong.
gsidebo
Successfully merging a pull request may close this issue.
We would like to use the API client to unenroll a user from a course in edX
The text was updated successfully, but these errors were encountered: