Giter Club home page Giter Club logo

openedx-api-wrapper's Introduction

Open edX REST API Wrapper

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.

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

# 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
  • Add tests
  • Gradually add more REST API endpoints from edx-plafrom

openedx-api-wrapper's People

Contributors

jramnai avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.