Google api批量更新导致HTTP 400错误。python

Google api批量更新导致HTTP 400错误。python,python,api,documentation,google-docs-api,Python,Api,Documentation,Google Docs Api,google api for docs给了我HTTP 400错误 googleapiclient.errors.HttpError: <HttpError 400 when requesting https://docs.googleapis.com/v1/documents/1Z2rAi7CJINAwxzizOsIw0_UB1iguHaduIDBV5cOZ4iQ:batchUpdate?alt=json returned "Invalid requests[0].insertText:

google api for docs给了我HTTP 400错误

googleapiclient.errors.HttpError: <HttpError 400 when requesting https://docs.googleapis.com/v1/documents/1Z2rAi7CJINAwxzizOsIw0_UB1iguHaduIDBV5cOZ4iQ:batchUpdate?alt=json returned "Invalid requests[0].insertText: The insertion index must be inside the bounds of an existing paragraph. You can still create new paragraphs by inserting newlines.">
compelte错误消息如下:


在您的请求中,您应该将位置索引指定为1,因为Google API是从1索引的

requests = [
        {
            'insertText': {
                'location': {
                    'index': 1,
                },
                'text': text1
            }
        }
    ]
requests = [
        {
            'insertText': {
                'location': {
                    'index': 1,
                },
                'text': text1
            }
        }
    ]