From d1c4d14c881b0e754ca220cdcda4d06fe23c81ab Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:29:33 -0400 Subject: [PATCH] chore(client): log response headers in debug mode (#480) --- src/anthropic/_base_client.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/anthropic/_base_client.py b/src/anthropic/_base_client.py index 3e688b50..ff02a9f7 100644 --- a/src/anthropic/_base_client.py +++ b/src/anthropic/_base_client.py @@ -946,6 +946,8 @@ def _request( if self.custom_auth is not None: kwargs["auth"] = self.custom_auth + log.debug("Sending HTTP Request: %s %s", request.method, request.url) + try: response = self._client.send( request, @@ -984,7 +986,12 @@ def _request( raise APIConnectionError(request=request) from err log.debug( - 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, ) try: