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?
A.
Create a loop on cancel the operation and run a new one after the code is received.
B.
Use exponential backoff when retrying distributed services and other remote endpoints.
C.
Build a try/except around the urlopen to find errors occurring in the request.
D.
Redirect the request to an internal web server and make a new request from the internal resource.
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
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.
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.
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
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.
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
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.
I agree. C is correct. It's an authorization issue.
upvoted 4 times
...
This section is not available anymore. Please use the main Exam Page.350-901 Exam Questions
Log in to ExamTopics
Sign in:
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.
tswinn
Highly Voted 3 years, 8 months agorazvan999
Most Recent 1 year, 4 months agodoble_h
1 year, 6 months agoMerlinTheWizard
10 months, 2 weeks agoZizu007
1 year, 7 months agokirrim
1 year, 6 months agomimimi
1 year, 7 months agoexamtopicstroilevw
1 month, 3 weeks agoImADude
11 months, 2 weeks agojohntermlen
1 year, 9 months agoTeringzooi
2 years, 7 months agodesignated
2 years, 8 months agoferock
3 years ago__al__
3 years, 1 month agopython_tamer
3 years, 3 months ago