Skip to content

[BITBUCKET CLOUD] Invalid pagination / missing next #652

@sti0

Description

@sti0

I tried to loop over my workspaces and over the repos to get all pipelines with the following code:

from atlassian.bitbucket.cloud import Cloud
from pprint import pprint

bb = Cloud(
    url="https://api.bitbucket.org",
    username="myusr",
    password="mypass",
)

for x in bb.workspaces.each():
    print(x.name)
    if x.slug == "myworkspace":
        y = x.repositories.get("myrepo")
        print(y.name, y.description)

        pipes = y.pipelines.each()
        for p in pipes:
            print(p.build_number)

It returns the following error

AssertionError: Wrong response for url [https://api.bitbucket.org/2.0/repositories/.../.../pipelines], the size attribute doesn't match the number of recieved values:

JSON Output of the request like this one:

{
    "page": 1,
    "pagelen": 10,
    "values": [....10 pipes here...],
    "size": 21
}

The size option gave me the total number of pipelines (21). But the response only gave me 10 pipes with no next attribute. Therefore an error happend here:

if not response.get("size", -1) == len(values):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions