Currently the "network_stream" response extension is only exposed on HTTP/1.1 connections...
>>> import httpcore
>>> with httpcore.ConnectionPool() as http:
... r = http.request("GET", "https://www.example.com")
... print(r.extensions["network_stream"].get_extra_info("server_addr"))
...
('93.184.216.34', 443)
...and is not exposed on HTTP/2 connections...
>>> import httpcore
>>> with httpcore.ConnectionPool(http2=True) as http:
... r = http.request("GET", "https://www.example.com")
... print(r.extensions["network_stream"].get_extra_info("server_addr"))
...
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
KeyError: 'network_stream'
We should resolve this.
Relevant sections of the code are here...
|
extensions={ |
|
"http_version": b"HTTP/2", |
|
"stream_id": stream_id, |
|
}, |
|
extensions={ |
|
"http_version": b"HTTP/2", |
|
"stream_id": stream_id, |
|
}, |
Currently the "network_stream" response extension is only exposed on HTTP/1.1 connections...
...and is not exposed on HTTP/2 connections...
We should resolve this.
Relevant sections of the code are here...
httpcore/httpcore/_async/http2.py
Lines 134 to 137 in eb5957d
httpcore/httpcore/_sync/http2.py
Lines 134 to 137 in eb5957d