【发布时间】:2021-10-21 18:18:06
【问题描述】:
我在 google 课堂网站上创建了一个作业,我想使用 Google Classroom API 对其评分。根据文档,这可以通过以下方式实现。
studentSubmission = {
'assignedGrade': 99,
'draftGrade': 80
}
service.courses().courseWork().studentSubmissions().patch(
courseId=<course ID or alias>,
courseWorkId=<courseWork ID>,
id=<studentSubmission ID>,
updateMask='assignedGrade,draftGrade',
body=studentSubmission).execute()
问题是我遇到了权限错误“@ProjectPermissionDenied The Developer Console project is not allowed to make this request。”据我了解,发生此错误是因为该网站使用的开发者控制台项目与我使用 make API 请求的项目不同。
我正在使用同一个 Google 帐户来验证 API 并在 Google Classroom 中创建课程作业。我还确认我拥有所有必需的范围,并使用“Try this API”方法在浏览器中测试了 API,并收到了相同的权限错误。
由于我的用例需要通过网站创建作业,我想知道是否有办法绕过权限错误,以便可以通过 API 对在网站上创建的作业进行评分?
【问题讨论】:
标签: python google-cloud-platform google-oauth google-classroom