Nexttoken value in QueryTableRows API

I am working on a lambda to export the data present in Honeycode. I am using QueryTableRows API to get the selected rows from the table. API reference:

Sample code:
def fetch_proposal_data(): response = honeycode_client.query_table_rows( workbookId=WORKBOOK_ID, tableId=PROPOSAL_TABLE_ID, filterFormula = {"formula": f'=FILTER(Proposals,"Proposals[Status]=""MEDICAL_EVALUATION_REQUIRED"" OR Proposals[Status]=""UNDER_WRITER_REVIEW""")'} ) return response

Above code might not return all data present in DB if the table size is huge, we probably need to fetch the records in pagination form. API reference mentioned here
From the above link, this is not very clear about how we can provide nextToken as the reference to the API call. What value should we pass as nextToken in the API request?

Hi @Jhut-caa0,

Thank you so much for your question.

On first call, the nextToken can be nul in the request. Upon getting the response from the first call, you will receive the nextToken from that response, you can then set it to 2nd request to paginate. Keep doing this in a loop until the response has no nextToken, then you know you have exhausted all result rows.

More details in our API guide QueryTableRows - Amazon Honeycode

Here's how to paginate through the result with page size of 100:

nextToken = None

while True:
    response = honeycode_client.query_table_rows(
        workbookId = <WORKBOOK_ID>,
        tableId = <TABLE_ID>,
        filterFormula = <...>,
        maxResults = 100,
        nextToken = nextToken
    <do something with the response>
    nextToken = response.get('nextToken', None)

    if not nextToken:

Please let us know if you have any other questions!

Thank you,