Python Wrapper around the Open edX LMS/Studio REST APIs.
This work is inspired by zoomus (Python Wrapper around zoom.us REST APIs) and Open edX REST API client created by Andrés.
I shamelessly copied most of the code from Braden MacDonald's GitHubGist.
- In
/edx/etc/lms.yml
and/edx/etc/studio.yml
files, add the following lines to the features section (just enable flags if already added).FEATURES: ENABLE_MOBILE_REST_API: true ENABLE_OAUTH2_PROVIDER: true ENABLE_COMBINED_LOGIN_REGISTRATION: true
- Save the files and restart the services.
- Log in to the Django administration console for your base URL. For example,
http://{your_URL}/admin
. - In Django OAuth Toolkit section select Applications.
- Select Add Application. A dialog box opens with the Client id and Client secret populated for the new application.
- For the Client type, select Public.
- Optionally, enter a User and an identifying Name.
- Select Save.
Use above generated Client id and Client secret to create Open edX REST API Client
# Import Open edX REST API client
from openedx_api_wrapper.client import OpenedxAPIClient
# Create client with lms URL, studio URL, client_id, client_secret
client = OpenedxAPIClient(
'http://localhost:18000',
'http://localhost:18010',
'client_id',
'client_secret'
)
# Get username
client.user.get_username()
- client.user.get_username()
- client.user.get_user_details(username)
- client.user.registration({"name":"john", "username":"johnd", "email":"[email protected]", "password":"edx", "country":"IN", "honor_code":True})
- Publish on PyPI
- Add tests
- Gradually add more REST API endpoints from edx-plafrom