Skip to content

[Bug] OC API client for Python ignore values defined in ChallengeSearchQuery when listing challenges #2296

@tschaffter

Description

@tschaffter

Is there an existing issue for this?

  • I have searched the existing issues

What product(s) are you seeing the problem on?

OpenChallenges

Current behavior

I'm trying to get all the challenges. The query shown below shows that all the challenges can be listed on a single page.

https://openchallenges.io/api/v1/challenges?sort=created&pageSize=1000

image

The following code fails to do the same in Python:

# Enter a context with an instance of the API client
challenges = []
with openchallenges_client.ApiClient(configuration) as api_client:
    api_instance = challenge_api.ChallengeApi(api_client)

    query = openchallenges_client.ChallengeSearchQuery(page_number=1, page_size=1000)
    pprint(query)

    try:
        # Get the first page of the list of challenges
        page = api_instance.list_challenges(query)
        pprint(page.total_pages)
        challenges.extend(page.challenges)
    except openchallenges_client.ApiException as e:
        print("Exception when calling ChallengeApi->list_challenges: %s\n" % e)

The page size return is always 3 and the number of results per page is 100, independently of the value of query. 100 is the default page size. However, I updated the API description, regenerated the API client and reinstalled it. The client code shows that the change is effective, but my script still fetch 100 challenges per page.

Expected behavior

No response

Anything else?

No response

Commit ID

No response

Are you developing inside the dev container?

  • I am using the dev container

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpython

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions