-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
return response from raise_for_status
#6215
Comments
This project is in indefinite feature-freeze and not changing the API in ways that may be surprising for existing users. Also I'm certain this has been requested before but am on mobile and can't easily search |
I am junior SDE, and I want to contribute to open source. This is my first time. |
@sigmavirus24 Is this still true?? Why is it in a feature-freeze? |
It's documented here: https://requests.readthedocs.io/en/latest/dev/contributing/#feature-requests |
I'd guess this has been requested before, but couldn't find any pointers so far.
(I also understand that requests does not accept feature requests, but this is code-wise a trivial one-line change, so I'm going to try anyway 😄 ).
Feature request: return
self
fromResponse.raise_for_status()
(instead of returningNone
implicitly).That allows using it in a compact chained/fluent manner, for example
With the current
raise_for_status
you can not use list comprehension like in this examle because you have to use separate statements for the.get()
,.raise_for_status()
and.json()
.(An alternative solution could be to add some kind of
raise_for_status
opt-in option to.get()
and alike, but that would require a lot more code changes than a simplereturn self
as proposed higher)The text was updated successfully, but these errors were encountered: