Implement http_version attribute on BaseResponse object
See original GitHub issueCurrently, I am utilizing requests, which under the hood uses urllib3, whose HTTPResponse object contains a .version
attribute, which is an int
, ten times greater than the actual HTTP version (i.e. 10 for 1.0, 11 for 1.1, etc).
I currently use it for logging my requests and responses in debug mode.
It would be good I think to implement a similar attribute (either version
or more specifically http_version
) for the BaseResponse object, for similar purposes, but perhaps use an actual float. What are your thoughts?
Proposal:
BaseResponse.http_version: float = 0.0 # Could be a floatEnum with known HTTP versions
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Implement http_version attribute on BaseResponse object #106
Currently, I am utilizing requests, which under the hood uses urllib3, whose HTTPResponse object contains a .version attribute, ...
Read more >The Response Object — asks 1.3.6 documentation
The three parts of the status line are the HTTP-Version, Status-Code and Reason-Phrase. They can be accessed as attributes of the response object...
Read more >c# - Creating Inherited Response Objects - Stack Overflow
I am writing some integration with a third-party eLearning platform that returns a variety of responses in different schemas depending on the ...
Read more >API Reference — Bottle 0.13-dev documentation
This MultiDict subclass is used to store request form data. Additionally to the normal dict-like item access methods (which return unmodified data as...
Read more >Request / Response Objects — Werkzeug Documentation (1.0 ...
Enforce that the WSGI response is a response object of the current type. Werkzeug will use the BaseResponse internally in many situations like...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yup. So we’ve got
response.protocol
, which is a string and right now can be either"HTTP/2"
or"HTTP/1.1"
.We actually ought to improve on that by using the
.http_version
thath11
returns in order to return"HTTP/1.0"
or"HTTP/0.9"
when appropriate.Its also possible that we might want to include a
.protocol_value
property which returns tuples such as eg.(1, 1)
,(2, 0)
.I wouldn’t necessarily switch to
http_version
, asprotocol
makes sense the way that it is now, I’d just mention it in the API compatibility docs.