Skip to content

max_results argument of Client.list_blobs does not behave correctly #425

@olfek

Description

@olfek

According to this

maxResults should be:

Maximum combined number of entries in items[] and prefixes[] to return in a single page of responses. Because duplicate entries in prefixes[] are omitted, fewer total results may be returned than requested. The service uses this parameter or 1,000 items, whichever is smaller.

When I do this:

client = storage.Client()
bucket = storage.Bucket(client, "<bucket_name>")
blobs_iterator = client.list_blobs(bucket, max_results=10)
for page in blobs_iterator.pages:
    print(page.num_items)

Output:

10

Only one iteration of the loop is completed even though there are 100 blobs in the bucket. It seems the max_results argument is limiting the total results rather than per page results.

Related to #19

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: storageIssues related to the googleapis/python-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions