200-901 Understanding and Using APIs Practice Question
A developer is writing a Python script that consumes a REST API. The API returns a large number of records and uses pagination via a 'next' link in the response body. The developer needs to automatically follow these links until all records are retrieved. Which Python library feature is most appropriate for making the HTTP requests and handling the pagination loop?
⚠ Common exam trap
The trap here is overcomplicating the solution by choosing low-level libraries or recursion when a simple loop with requests is sufficient and standard.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
requests library with a while loop that checks for the 'next' link
The requests library simplifies HTTP interactions and, combined with a while loop that follows the 'next' link until it is absent, efficiently retrieves all paginated records. Other options are either too low-level, assume fixed pagination, or use inappropriate constructs like recursion, making them less suitable for this task.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
requests library with a while loop that checks for the 'next' link
Why this is correct
The requests library is the standard for making HTTP calls in Python. A while loop can repeatedly call the 'next' URL until it is absent, aggregating results. This approach is straightforward and effective for following pagination links provided in the response body, allowing the script to retrieve all records without manual intervention.
- ✗
http.client with a for loop over a range of page numbers
Why it's wrong here
http.client is a low-level library that requires manual handling of connections and parsing. A for loop over a range assumes a fixed number of pages, which is not the case when following 'next' links. This approach would fail to dynamically follow pagination and could miss records or make unnecessary requests, making it unsuitable.
- ✗
urllib.request with a recursive function
Why it's wrong here
While urllib.request can make HTTP calls, it is lower-level and more verbose than requests. Using a recursive function for pagination could lead to stack overflow if there are many pages. It is not the most appropriate choice for this scenario, as requests with a loop is simpler and more readable, and recursion is unnecessary.
- ✗
socket library to send raw HTTP requests
Why it's wrong here
The socket library is used for low-level network communication and does not provide HTTP conveniences. Implementing pagination with raw sockets would require manually constructing HTTP requests, parsing responses, and handling headers, which is error-prone and overly complex. It is not appropriate for consuming a REST API with pagination.
Go deeper
Related to this question
About these practice questions
This 200-901 question is part of Courseiva's 975-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Cisco exam blueprint
This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.