-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http status codes not passed back to caller #408
Comments
Hey, we just merged in #412 which allows you to retrieve the full response object from the previous request. This way you can access the status_code as well as the response headers in whichever cases make sense. Going to close this issue as this will be out in the next release. Thanks for the report! |
I'd like to re-open this. The method of fetching the entire http response in #412 isn't sufficient for multi-threaded programs. |
Posting an update here for completeness: we continued this discussion on the original PR. This was reimplemented in a more threadsafe way #414 that allows you to retrieve the full raw response object. |
Reopening based on the note from #414 |
Thanks for your contribution! This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community. If you would like this issue to remain open:
|
Thanks for your contribution! This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community. If you would like this issue to remain open:
|
As discussed in #414, this is likely not something that we'll be able to do without and significant rework of the library while keeping backward compatibility. |
In some cases it's useful for the caller to know the underlying http status code returned by requests. As of now, status codes never make their way back to the caller. This makes it difficult to decide how to proceed after a failed request. Just about every error that the API could throw is wrapped in something like
{'errors': [...]}
. This is fine for some use cases but unless we know every possible message that might end up in that datastruct we'll have a hard time knowing exactly how to proceed.There is the option to set
datadog.api._mute = False
which will cause exceptions to bubble up to the caller. But in this case, things like ApiError are too broad to take make decisions on. e.g. I may wish to never retry a failed request due to a 403 or 404 but I certainly want to retry a request with that has failed with a 429.#378 is related in that it's asking for a little more detail on failed requests. Maybe we pass both status codes and relevant headers back to the caller?
The text was updated successfully, but these errors were encountered: