Skip to content

Commit

Permalink
httpx: update type hints to RequestInfo/ResponseInfo (#3105)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex authored Dec 17, 2024
1 parent f8b0f72 commit d155540
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased

### Fixed

- `opentelemetry-instrumentation-httpx` Fix `RequestInfo`/`ResponseInfo` type hints
([#3105](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3105))

## Version 1.29.0/0.50b0 (2024-12-11)

### Added
Expand Down
2 changes: 2 additions & 0 deletions docs/nitpick-exceptions.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ py-class=
httpx.SyncByteStream
httpx.AsyncByteStream
httpx.Response
httpx.URL
httpx.Headers
aiohttp.web_request.Request
yarl.URL
cimpl.Producer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ async def async_response_hook(span, request, response):
---
"""

from __future__ import annotations

import logging
import typing
from asyncio import iscoroutinefunction
Expand Down Expand Up @@ -249,8 +251,8 @@ async def async_response_hook(span, request, response):

class RequestInfo(typing.NamedTuple):
method: bytes
url: URL
headers: typing.Optional[Headers]
url: httpx.URL
headers: httpx.Headers | None
stream: typing.Optional[
typing.Union[httpx.SyncByteStream, httpx.AsyncByteStream]
]
Expand All @@ -259,7 +261,7 @@ class RequestInfo(typing.NamedTuple):

class ResponseInfo(typing.NamedTuple):
status_code: int
headers: typing.Optional[Headers]
headers: httpx.Headers | None
stream: typing.Iterable[bytes]
extensions: typing.Optional[dict]

Expand Down

0 comments on commit d155540

Please sign in to comment.