某些较旧的Google API(如联系人)允许您拨打批量电话。 这可以通过Python Drive API实现吗?
具体来说,我想知道是否可以在一次API调用中获取多个文件的注释。
答案 0 :(得分:3)
挖掘文档后的一个简单示例,假设您将凭据存储在变量creds中:
def list_animals(request_id, response, exception):
if exception is not None:
# Do something with the exception.
pass
else:
# Do something with the response.
pass
def list_farmers(request_id, response, exception):
if exception is not None:
# Do something with the exception.
pass
else:
# Do something with the response.
pass
service_ = authHandler.CreateService('drive', 'v2', creds)
batch = BatchHttpRequest()
batch.add(service_.changes().list(), list_animals)
batch.add(service_.changes().list(), list_farmers)
batch.execute(http=authHandler.getHttp(creds))