Skip to content

Commit 36daee6

Browse files
Revert "explicitly close response object"
This reverts commit 2124fe0.
1 parent 97707f5 commit 36daee6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/databricks/sql/backend/sea/utils/http_client.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,17 @@ def _make_request(
189189

190190
logger.debug(f"Making {method} request to {path}")
191191

192-
response = None
193192
try:
194193
response = self.session.request(
195194
method=method.upper(),
196195
url=f"{self.base_url}{path}",
197196
json=data, # requests handles JSON encoding automatically
198197
headers=headers,
199198
)
200-
response.raise_for_status()
199+
200+
response.raise_for_status() # This will raise an HTTPError for non-2xx responses
201201
return response.json()
202+
202203
except MaxRetryDurationError as e:
203204
# MaxRetryDurationError is raised directly by DatabricksRetryPolicy
204205
# when duration limits are exceeded
@@ -217,9 +218,6 @@ def _make_request(
217218
logger.error(f"SEA HTTP request failed with exception: {e}")
218219
error_message = f"Error during request to server. {e}"
219220
raise RequestError(error_message, None, e)
220-
finally:
221-
if response is not None:
222-
response.close()
223221

224222
def _get_command_type_from_path(self, path: str, method: str) -> CommandType:
225223
"""

0 commit comments

Comments
 (0)