Exercise: Query Repos With Parameters
Martin Diergardt on March 31, 2026
Thank you for these practical exercises. It is helpful to apply the learned material immediately. However, one needs to carefully read the instructions. I had first “sort_by” instead of “sort” in the params keys, which didn’t do anything meaningful.
Bartosz Zaczyński RP Team on April 19, 2026
@Sanchit, the expected query parameter names are called out in the Requirements section of the exercise description: “Pass sort and direction as query parameters to the API.” The hints reinforce it too.
One spot that’s easy to miss (and where another learner ran into the same thing) is that the function’s keyword argument sort_by="name" and the API’s query parameter "sort" have different names. That’s intentional in the exercise. The Python side uses sort_by because sort would shadow the built-in sorted()/list.sort() mental model, while the HTTP API itself uses the shorter sort. So in your params dictionary, the key has to be "sort" (not "sort_by"):
params = {"sort": sort_by, "direction": direction}
response = requests.get(f"{base_url}/orgs/python/repos", params=params)
Hope that unblocks you.
Become a Member to join the conversation.

Sanchit Sagar on March 29, 2026
How the hell am I supposed to know what the query params are? It’s not very well structured, the questions.