Skip to content

Commit d642c14

Browse files
committed
Use the right type hints on httpx RequestInfo/ResponseInfo
1 parent 37e05af commit d642c14

File tree

1 file changed

+5
-3
lines changed
  • instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx

1 file changed

+5
-3
lines changed

instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ async def async_response_hook(span, request, response):
192192
---
193193
"""
194194

195+
from __future__ import annotations
196+
195197
import logging
196198
import typing
197199
from asyncio import iscoroutinefunction
@@ -249,8 +251,8 @@ async def async_response_hook(span, request, response):
249251

250252
class RequestInfo(typing.NamedTuple):
251253
method: bytes
252-
url: URL
253-
headers: typing.Optional[Headers]
254+
url: httpx.URL
255+
headers: httpx.Headers | None
254256
stream: typing.Optional[
255257
typing.Union[httpx.SyncByteStream, httpx.AsyncByteStream]
256258
]
@@ -259,7 +261,7 @@ class RequestInfo(typing.NamedTuple):
259261

260262
class ResponseInfo(typing.NamedTuple):
261263
status_code: int
262-
headers: typing.Optional[Headers]
264+
headers: httpx.Headers | None
263265
stream: typing.Iterable[bytes]
264266
extensions: typing.Optional[dict]
265267

0 commit comments

Comments
 (0)