我正在从这里运行“添加教师”示例代码:https ://developers.google.com/classroom/guides/manage-users ,使用 python 2.7。它今天早些时候工作,但现在我收到此错误:
Traceback (most recent call last):
File "test.py", line 93, in <module>
main()
File "test.py", line 79, in main
body=teacher).execute()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client-1.4.12-py2.7.egg/oauth2client/util.py", line 137, in positional_wrapper
File "build/bdist.macosx-10.10-x86_64/egg/googleapiclient/http.py", line 729, in execute
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://classroom.googleapis.com/v1/courses/185092455/teachers?alt=json returned "Request contains an invalid argument.">
我以域超级管理员的身份运行它,并请求范围教室.课程、教室.名册和教室.profile.emails。当我使用 course.teachers/create 的 API 参考条目底部的“试用”框时,我得到了同样的错误。
怎么了?我怀疑它与权限/OAuth 密钥有关,但我真的不知道。