Tell us your story
Tell us your story
How has offline Wikipedia affected you? The Wikimedia Foundation (the non-profit that supports Wikipedia) is looking for personal, diverse and inspiring stories about how offline Wikipedia affects the world. If you have a personal story that you would like to share, please contact: stories@kiwix.org. Thank you!

Changes

Jump to: navigation, search

Projects/open edx

920 bytes added, 3 years ago
m
add exemple of api usage
Course instructor choose their license for content.
<nowiki>#</nowiki>== Using API==
You Must register with the Open edX server with Oauth 2.0
Documentation : https://edx.readthedocs.io/projects/edx-platform-api/en/latest/courses/index.html
it's use [https://en.wikipedia.org/wiki/XBlock Xblocks] and we can get them with the API. List of Xblocks is available here : https://openedx.atlassian.net/wiki/display/COMM/XBlocks+Directory
 
<nowiki>===Exemple using API===</nowiki><syntaxhighlight lang="python3" line="1">
#!/usr/bin/env python3
 
import requests
import json
 
url = "https://www.fun-mooc.fr/api/courses/v1/courses/"
data={"pagination" : { "next" :url } }
#data["pagination"]["next"] = url
while data["pagination"]["next"] != None:
r = requests.get(data["pagination"]["next"])
data=r.json()
for course in data["results"]:
print(course["course_id"] , " : ", course["name"])
</syntaxhighlight><syntaxhighlight lang="python3" line="1">
#!/usr/bin/env python3
 
import requests
import json
 
url = "https://www.fun-mooc.fr/api/courses/v1/courses/"
data={"pagination" : { "next" :url } }
#data["pagination"]["next"] = url
while data["pagination"]["next"] != None:
r = requests.get(data["pagination"]["next"])
data=r.json()
for course in data["results"]:
print(course["course_id"] , " : ", course["name"])
</syntaxhighlight>
14
edits

Navigation menu