200-901 Network Fundamentals Practice Question
A developer is writing a Python script using requests to retrieve a large JSON payload from an API. The server responds with headers including Content-Encoding: gzip, and the response body appears as binary data. The script must automatically decompress the payload to parse it as JSON. Which requests library behavior should the developer rely on?
⚠ Common exam trap
The trap here is assuming that response.content always returns decoded text, when it actually returns raw bytes that may still be compressed.
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
✓
The requests library automatically decompresses gzip-encoded responses when accessing response.text or response.json().
The requests library automatically decompresses gzip-encoded responses when the developer accesses response.text or response.json(). This behavior is driven by the Content-Encoding header and allows seamless parsing of JSON payloads without manual gzip handling. Using response.content returns raw compressed bytes, so the higher-level accessors are necessary for this scenario.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The developer must set the Accept-Encoding header to identity to force the server to send uncompressed JSON.
Why it's wrong here
Setting Accept-Encoding to identity requests no compression, but it does not help when the server already sent a gzip-encoded response. It also disables a useful bandwidth optimization. The developer cannot change the server's existing response headers, so this approach would not decompress the received payload. The correct fix is to let requests handle the decompression via its standard response accessors.
- ✗
The response.content attribute automatically decodes gzip-encoded bodies before returning them.
Why it's wrong here
response.content returns the raw bytes exactly as received from the server, with no decompression applied. In this scenario, the binary gzip data would remain compressed, causing json parsing to fail. The developer would need to manually decompress using the gzip module before decoding. Relying on content here is incorrect because it bypasses the library's built-in decoding logic for compressed responses.
- ✗
The response.json() method requires the developer to pass a decompression parameter set to True.
Why it's wrong here
The response.json() method does not accept a decompression parameter. It relies on response.text, which already handles decompression automatically when the Content-Encoding header indicates gzip. Passing an unsupported argument would raise a TypeError. This distractor misrepresents the API surface of the requests library and ignores its built-in handling of compressed responses.
- ✓
The requests library automatically decompresses gzip-encoded responses when accessing response.text or response.json().
Why this is correct
The requests library inspects the Content-Encoding header and transparently decompresses gzip (and deflate) bodies when you use response.text or response.json(). This allows the developer to parse the JSON payload without manual intervention. The raw compressed bytes are only visible via response.content, so using the higher-level accessors triggers the automatic decompression needed for this scenario.
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.