Skip to content
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

Add HTTP status group properties for response objects #6822

Closed
wants to merge 5 commits into from

Conversation

vengatgs
Copy link

@vengatgs vengatgs commented Nov 8, 2024

PR Description:

This PR adds properties (is_2xx_successful, is_5xx_server_error, etc.) to the HTTP response class for easy classification of HTTP status codes, improving code readability.

Justification:

  • Improved readability: Using direct range comparisons like 100 <= self.status_code < 200 makes the code clear and intuitive.
  • Maintaining performance: The range comparison is efficient and keeps the performance trade-offs minimal while avoiding unnecessary complexity.

@sigmavirus24
Copy link
Contributor

No thank you. We're not expanding the API of Requests at this time and the freeze is well documented. Sorry you spent your energy on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants