本文介绍了EDX课程API:获取EDX课程列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在用python/flask创建一个项目.我想获得edx所有课程的清单.但是API逐页提供列表.我不知道如何获取整个列表.任何帮助表示赞赏.谢谢!

I am making a project in python/flask. I want to get a list of all the courses of edx. But the API provides the list page by page. I can't figure out how to get the entire list. Any help is appreciated. Thanks!

推荐答案

我假设您正在使用此终结点 https://courses.edx.org/api/courses/v1/courses/

I assume you are using this endpoint https://courses.edx.org/api/courses/v1/courses/

可以看出,结果中有一个pagination块:

As can be seen, there is a pagination block in the result:

"pagination": {
        "count": 3261,
        "previous": null,
        "num_pages": 327,
        "next": "https://courses.edx.org/api/courses/v1/courses/?page=2"
    },

此块中的next字段将帮助您获取结果的下一页.您无法一口气获取所有课程.

The next field in this block will help you fetch the next page of the results. You cannot fetch all the courses in one go.

这篇关于EDX课程API:获取EDX课程列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 15:48