Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jramnai/openedx-api-wrapper
Python client library for Open edX REST APIs
https://github.com/jramnai/openedx-api-wrapper
edx oauth2-client openedx rest-api
Last synced: about 1 month ago
JSON representation
Python client library for Open edX REST APIs
- Host: GitHub
- URL: https://github.com/jramnai/openedx-api-wrapper
- Owner: jramnai
- License: apache-2.0
- Created: 2021-07-05T15:20:07.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-17T10:54:35.000Z (almost 3 years ago)
- Last Synced: 2024-04-16T03:25:13.729Z (7 months ago)
- Topics: edx, oauth2-client, openedx, rest-api
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Open edX REST API Wrapper
Python Wrapper around the [Open edX LMS/Studio](https://github.com/edx/edx-platform) REST APIs.
This work is inspired by [zoomus](https://github.com/prschmid/zoomus) (Python Wrapper around zoom.us REST APIs) and [Open edX REST API client ](https://github.com/aulasneo/openedx-rest-api-client) created by Andrés.
I shamelessly copied most of the code from Braden MacDonald's [GitHubGist](https://gist.github.com/bradenmacdonald/930c7655dca32dc648af9cb0aed4a7c5).
# Prerequisite (to be achieved on Open edX instance)
### Enable Mobile Application Features
1. 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
```
2. Save the files and restart the services.### Create a new OAuth Application
1. Log in to the Django administration console for your base URL. For example, `http://{your_URL}/admin`.
2. In **Django OAuth Toolkit** section select **Applications**.
3. Select **Add Application**. A dialog box opens with the **Client id** and **Client secret** populated for the new application.
4. For the **Client type**, select **Public**.
5. Optionally, enter a **User** and an identifying **Name**.
6. Select **Save**.Use above generated **Client id** and **Client secret** to create Open edX REST API Client
# Usage
```python
# 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()
```
# Available methods
- 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})# Future Work
- Publish on [PyPI](https://pypi.org/)
- Add tests
- Gradually add more REST API endpoints from [edx-plafrom](https://github.com/edx/edx-platform)