Python 如何在Google API apiclient批回调中使用请求\u id

Python 如何在Google API apiclient批回调中使用请求\u id,python,google-api,google-api-client,bulk,apiclient,Python,Google Api,Google Api Client,Bulk,Apiclient,我目前正在使用Google API库中的apiclient。特别是python。文件确实不清楚。我不知道如何利用从回调中获得的request\u id。我的意思是,对于这个代码: from apiclient.http import BatchHttpRequest def insert_animal(request_id, response, exception): if exception is not None: # Do something with the excepti

我目前正在使用Google API库中的
apiclient
。特别是python。文件确实不清楚。我不知道如何利用从回调中获得的
request\u id
。我的意思是,对于这个代码:

from apiclient.http import BatchHttpRequest

def insert_animal(request_id, response, exception):
  if exception is not None:
    # Do something with the exception
    pass
  else:
    # Do something with the response
    pass

service = build('farm', 'v2')

batch = service.new_batch_http_request(callback=insert_animal)

batch.add(service.animals().insert(name="sheep"))
batch.add(service.animals().insert(name="pig"))
batch.add(service.animals().insert(name="llama"))
batch.execute(http=http)

有人能解释一下请求id吗?我是否可以自定义该值?

请求\u id
是请求添加到批处理请求时顺序的整数。它从1开始

虽然内容是一个整数,但它存储为字符串。真奇怪