exam questions

Exam 350-901 All Questions

View all questions & answers for the 350-901 exam

Exam 350-901 topic 1 question 76 discussion

Actual exam question from Cisco's 350-901
Question #: 76
Topic #: 1
[All 350-901 Questions]

DRAG DROP -
A developer is creating a Python script to catch errors using REST API calls and to aid in debugging. Drag and drop the code from the bottom onto the box where the code is missing to implement control flow for REST API errors. Not all options are used.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Johnno26
Highly Voted 2 years, 5 months ago
Suggest answer seems correct: In the event of a network problem (e.g. DNS failure, refused connection, etc), Requests will raise a ConnectionError exception. In the event of the rare invalid HTTP response, Requests will raise an HTTPError exception. If a request times out, a Timeout exception is raised. If a request exceeds the configured number of maximum redirections, a TooManyRedirects exception is raised. All exceptions that Requests explicitly raises inherit from requests.exceptions.RequestException. https://docs.python-requests.org/en/latest/user/quickstart/#errors-and-exceptions
upvoted 5 times
kirrim
8 months ago
Agree with your analysis, just wanted to piggyback on your comment to point out that the exhibit source code does not include res.raise_for_status() so it won't actually work, as written.
upvoted 2 times
...
...
Teringzooi
Most Recent 1 year, 9 months ago
ConnectionError Timeout RequestExpection KeyboardInterrupt
upvoted 4 times
...
designated
1 year, 10 months ago
ConnectionError Timeout RequestExpection KeyboardInterrupt " - exception requests.RequestException >There was an ambiguous exception that occurred while handling your request. - exception requests.HTTPError > An HTTP error occurred. - exception requests.URLRequired > A valid URL is required to make a request. - exception requests.TooManyRedirects > Too many redirects. - exception requests.ConnectTimeout > The request timed out while trying to connect to the remote server. (Requests that produced this error are safe to retry.) - exception requests.ReadTimeout > The server did not send any data in the allotted amount of time. - exception requests.Timeout > The request timed out. (Catching this error will catch both ConnectTimeout and ReadTimeout errors.)" https://requests.readthedocs.io/en/latest/api/#requests.ConnectionError
upvoted 2 times
...
CiscoRider
2 years, 1 month ago
I agree with the answers provided too. I also find interesting this post https://stackoverflow.com/questions/49099313/how-to-get-the-exception-string-from-requests-exceptions-requestexception
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...