Reading a requests response
QuizEasy-MediumPython onlyAsked in: Capgemini, CloudSEK, Swiggy, Wipro
A test calls r = requests.get(url, timeout=10) and the server answers 404. Which statements are true? Choose all that apply.
- requests.get itself does not raise an error for a 404; r.status_code is 404
- r.ok is False
- r.raise_for_status() raises requests.HTTPError
- r.json() always returns a list
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.