[Python] Truncation on Notion rollups

Discussão em 'Python' iniciado por Stack, Agosto 2, 2025.

  1. Stack

    Stack Membro Participativo

    I made a project to update some Notion tables automatically.

    By runing this code:

    def PegarPaginas(index_instancia: int, n_paginas: int = 1):
    url = f"https://api.notion.com/v1/databases/{ENV_VARS.IDS_DB[index_instancia]}/query"
    payload = {"page_size": n_paginas}

    response = requests.post(url, headers=headers, json=payload)

    dados = response.json()

    results = dados["results"]

    return results

    pagina_acumulos = PegarPaginas(ID_instancias.ACUMULOS.value)[0]

    n=0
    for r in pagina_acumulos["properties"][ENV_VARS.STR_RELATIONS_ACUMULOS[0]]["relation"]:
    n+=1
    print(r)
    print(n)


    This returns 25 rollups:

    Output:
    [...]
    {'id': '`my 24th ID`'}
    24
    {'id': '`my 25th ID`'}
    25


    But it should return 28. This table And it seems that no matter how many items there are more than 25, it only loads 25.

    By changing:

    ENV_VARS.STR_RELATIONS_ACUMULOS[0]


    to

    ENV_VARS.STR_RELATIONS_ACUMULOS[1]


    another table with 29 rollups

    I get:

    Output:

    {'id': '`my24th ID`'}
    24
    {'id': '`my 25th ID`'}
    25


    Why might it be? Is there a way to load all of them properly?

    Thanks in advance.

    Continue reading...

Compartilhe esta Página