Chunks Error

chunksArray = jsonResponse["chunks"]
KeyError: 'chunks'




Hi all, 
I have connected with Anaplan through API with help of Python .

Basically I am Exporting file from Anaplan for getting suggestion
But now If i am using my credentials and my Model it is working fine.
But for others it showing error above pasted.

Chunks are generating in my scenario but not on others


  • @pankajnegi1920 

    Great question and one that can cause some challenges if the file/export is too big. I would recommend you get the chunk data first then use Python to iterate on each chunk. That should work. Here's a sample Python script to help you.

    import requests

    import base64

    import sys

    import json

    from getAuthentication import userBA

    from getGUIDs import wGuid, mGuid, fileID, fileName

    url = (f'{wGuid}/models/{mGuid}/' +


    getHeaders = {

        'Authorization': userBA


    downloadHeaders = {

        'Authorization': userBA,

        'Accept': 'application/octet-stream'


    getChunkData = requests.get(url,


    with open('downloadChunkData.json', 'wb') as f:


    with open('downloadChunkData.json', 'r') as f:

        f2 = json.load(f)

    with open(f'{fileName}', 'wb') as f:

        for i in f2:

            chunkData = i

            chunkID = i['id']

            print(f'Getting chunk {chunkID}')

            getChunk = requests.get(url + f'/{chunkID}',



            print('Status code: ' + str(getChunk.status_code))

  • Others export and mine has no difference in size, although they have small one.
    Json response is also ok but not including Key 'chunks' in others case
    Like this: 


    {'meta': {'paging': {'currentPageSize': 0, 'offset': 0, 'totalSize': 0}, 'schema': '
    objects/chunk'}, 'status': {'code': 200, 'message': 'Success'}}