scheduler.py 文件源码

python
阅读 52 收藏 0 点赞 0 评论 0

项目:coursera-scheduled-exports 作者: LU-C4i 项目源码 文件源码
def get_course_id(self):
        # Link below retrieves JSON file with course information based on course name
        base_url = "https://www.coursera.org/api/onDemandCourses.v1?q=slug&slug="
        # Paste
        url_tmp = base_url + self.course_slug
        # GET
        resp = requests.get(url_tmp)
        # If not ok
        if not resp.ok:
            # Log event
            if self.log:
                logging.error("Cannot fetch course id ({})".format(self.course_slug))
            raise ApiResolve("Server returned {}. Check whether course name is correct.".format(str(resp)))
        json_data = resp.json()
        # Get courseID
        course_id = json_data["elements"][0]["id"]
        # Return
        self.course_id = course_id
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号