Skip to content

Commit d657b9d

Browse files
remove finally
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent 76fdb98 commit d657b9d

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/databricks/sql/auth/oauth.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,14 @@ def refresh(self) -> Token:
340340
response = self._http_client.request(
341341
method=HttpMethod.POST, url=self.token_url, headers=headers, body=data
342342
)
343-
try:
344-
if response.status == 200:
345-
oauth_response = OAuthResponse(
346-
**json.loads(response.data.decode("utf-8"))
347-
)
348-
return Token(
349-
oauth_response.access_token,
350-
oauth_response.token_type,
351-
oauth_response.refresh_token,
352-
)
353-
else:
354-
raise Exception(
355-
f"Failed to get token: {response.status} {response.data.decode('utf-8')}"
356-
)
357-
finally:
358-
response.close()
343+
if response.status == 200:
344+
oauth_response = OAuthResponse(**json.loads(response.data.decode("utf-8")))
345+
return Token(
346+
oauth_response.access_token,
347+
oauth_response.token_type,
348+
oauth_response.refresh_token,
349+
)
350+
else:
351+
raise Exception(
352+
f"Failed to get token: {response.status} {response.data.decode('utf-8')}"
353+
)

0 commit comments

Comments
 (0)