Exam 350-901 All QuestionsBrowse all questions from this exam
Question 70

A developer is building an application to access a website. When running the application, an HTTP 403 error code has been received.

How should the application be modified to handle this code?

    Correct Answer: C

    An HTTP 403 error code means that the server understood the request but refuses to authorize it. This typically happens because the client does not have the necessary permissions to access the resource. Simply retrying with exponential backoff will not resolve permission issues. The appropriate approach in this case is to handle the error using a try/except block to capture the specific error and handle it gracefully within the application.

Discussion
tswinnOption: C

I think C. 403 is forbidden. So a backoff/retry will not help here because the connection to the server worked.

python_tamerOption: C

I agree. C is correct. It's an authorization issue.

Zizu007Option: B

B: The correct approach to handle an HTTP 403 error code when building an application to access a website is: B. Use exponential backoff when retrying distributed services and other remote endpoints. Exponential backoff is a common strategy for handling temporary errors like HTTP 403 (Forbidden). It involves progressively increasing the time between retries when a request encounters an error, which helps to avoid overloading the server and gives it some time to recover. This approach is more efficient and considerate than the other options listed.

kirrim

HTTP 403 means Forbidden. The user has successfully authenticated, but they are not allowed access to whatever they are trying to access. No amount of backoffs or retries or looping is going to fix this. They can retry forever and will be told "no" repeatedly. You have to build in error handling to gracefully inform the user they just don't have permission to access the resource, and let them choose where to go from there. The error handling in Python is try/except around the HTTP GET request.

mimimiOption: B

Sorry but you are all wrong. Software engineer here! error 403 is a forbidden error, and you have to check the reason field to address the error properly(it can have many reasons). One of the reasons can be "User rate limit exceeded", and as google suggest you should implement an exponential backoff. Here is the reference: https://developers.google.com/drive/api/guides/handle-errors#resolve_a_403_error_user_rate_limit_exceeded Be wise and choose B

ImADude

If that's only one of the reasons, then you can't say exponential backoff will definitely handle the issue. Alternatively, you should handle the error using a try/except block to ensure the application can gracefully deal with the unauthorized request and take necessary actions based on the specific reason for the 403 error.

designatedOption: C

C is correct - 403 Forbidden is an unrecoverable error that must be treated as an exception since it will be necessary for the user interaction to fix this issue and will not be recovered if we simply try again.

ferockOption: C

403 Forbidden: You are authenticated and authorized but do not have the permission to access the resource.

__al__Option: C

C... absolutely

razvan999Option: C

400, 401, 403 and are part of unrecoverable errors and "there is nothing to do but involve yourself in the troubleshooting procedure": • Read the response status code returned by the REST API • Read the HTTP headers returned by the REST API • Read the body of the response

doble_hOption: B

let's say that a rate limit is exceeded but for the day quota you may get a 403 forbidden to certain resources.

MerlinTheWizard

rate - rate exceeded, not forbidden

johntermlenOption: C

The correct answer is C. Build a try/except around the urlopen to find errors occurring in the request. An HTTP 403 error code indicates that the server is refusing to authorize the request. This can happen for a number of reasons, such as the user not having the correct permissions

TeringzooiOption: C

Answer: C 403 Forbidden: You are authenticated and authorized but do not have the permission to access the resource.