Skip to content

Commit 8888727

Browse files
authored
fix: add debug printout on GET (#75)
1 parent 8ce80f7 commit 8888727

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

ims_envista/commons.py

+3-26
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,9 @@
99
from uuid import UUID
1010

1111
import async_timeout
12-
from aiohttp import (
13-
ClientError,
14-
ClientResponse,
15-
ClientSession,
16-
TraceRequestChunkSentParams,
17-
TraceRequestEndParams,
18-
TraceRequestStartParams,
19-
)
12+
from aiohttp import ClientError, ClientResponse, ClientSession
2013

21-
logger = logging.getLogger(__name__)
14+
_LOGGER = logging.getLogger(__name__)
2215

2316

2417
class ImsEnvistaApiClientError(Exception):
@@ -36,23 +29,6 @@ class ImsEnvistaApiClientAuthenticationError(
3629
):
3730
"""Exception to indicate an authentication error."""
3831

39-
40-
async def on_request_start_debug(session: ClientSession, context,params: TraceRequestStartParams) -> None: # noqa: ANN001, ARG001
41-
logger.debug("HTTP %s: %s", params.method, params.url)
42-
43-
44-
async def on_request_chunk_sent_debug(
45-
session: ClientSession, context, params: TraceRequestChunkSentParams # noqa: ANN001, ARG001
46-
) -> None:
47-
if (params.method in ("POST", "PUT")) and params.chunk:
48-
logger.debug("HTTP Content %s: %s", params.method, params.chunk)
49-
50-
51-
async def on_request_end_debug(session: ClientSession, context, params: TraceRequestEndParams) -> None: # noqa: ANN001, ARG001
52-
response_bytes = await params.response.read() # Read the raw bytes
53-
logger.debug("HTTP %s Response <%s>: %s", params.method, params.response.status, response_bytes)
54-
55-
5632
def _get_headers(token: UUID | str) -> dict[str, str]:
5733
return {
5834
"Accept": "application/vnd.github.v3.text-match+json",
@@ -83,6 +59,7 @@ async def get(
8359

8460
try:
8561
async with async_timeout.timeout(180):
62+
_LOGGER.debug("Sending GET from %s", url)
8663
response = await session.get(
8764
url=url,
8865
headers=headers

0 commit comments

Comments
 (0)