“未定义变量:http”,当我在Google教室尝试批量注册参考代码时出错

问题描述 投票:-1回答:1

我正在尝试测试批量注册以建立Google课堂,但是我发现batch.execute(http=**http**)出现一些编译错误>

错误消息是“未定义的变量:http”

这是代码,此代码的最后一部分发生了编译错误。

def callback(request_id, response, exception):
    if exception is not None:
        print('Error adding user "{0}" to the course course: {1}'.format(
            request_id, exception))
    else:
        print('User "{0}" added as a student to the course.'.format(
            response.get('profile').get('name').get('fullName')))
batch = service.new_batch_http_request(callback=callback)
for student_email in student_emails:
    student = {
        'userId': student_email
    }
    request = service.courses().students().create(courseId=course_id,
                                                  body=student)
    batch.add(request, request_id=student_email)
batch.execute(http=http)

并且参考文献在下面。

https://developers.google.com/classroom/guides/batch#python

有人帮我。

[我正在尝试测试批量注册以建立Google课堂,但是我在batch.execute(http = ** http **)上发现了一些编译错误,错误消息是“未定义的变量:http”,这是代码。 ..

python google-classroom
1个回答
1
投票

让我们深入研究文档以找到答案!

© www.soinside.com 2019 - 2024. All rights reserved.