Skip to content

Commit ae93e9d

Browse files
fix type issues
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 446126c commit ae93e9d

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

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

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import json
22
import logging
33
import requests
4-
from typing import Dict, Any, Optional, Union, List
4+
from typing import Dict, Any, Optional, Union, List, Tuple
55
from urllib.parse import urljoin
66

77
from databricks.sql.auth.authenticators import AuthProvider
@@ -23,7 +23,7 @@ def __init__(
2323
server_hostname: str,
2424
port: int,
2525
http_path: str,
26-
http_headers: List[tuple],
26+
http_headers: List[Tuple[str, str]],
2727
auth_provider: AuthProvider,
2828
ssl_options: SSLOptions,
2929
**kwargs,
@@ -49,7 +49,7 @@ def __init__(
4949

5050
self.base_url = f"https://{server_hostname}:{port}"
5151

52-
self.headers = dict(http_headers)
52+
self.headers: Dict[str, str] = dict(http_headers)
5353
self.headers.update({"Content-Type": "application/json"})
5454

5555
self.max_retries = kwargs.get("_retry_stop_after_attempts_count", 30)
@@ -111,23 +111,32 @@ def _make_request(
111111
"""
112112

113113
url = urljoin(self.base_url, path)
114-
headers = {**self.headers, **self._get_auth_headers()}
114+
headers: Dict[str, str] = {**self.headers, **self._get_auth_headers()}
115115

116116
logger.debug(f"making {method} request to {url}")
117117

118118
try:
119-
kwargs = {
120-
"url": url,
121-
"headers": headers,
122-
"json": data,
123-
"params": params,
124-
}
125119
if method.upper() == "GET":
126-
response = self.session.get(**kwargs)
120+
response = self.session.get(
121+
url=url,
122+
headers=headers,
123+
json=data,
124+
params=params,
125+
)
127126
elif method.upper() == "POST":
128-
response = self.session.post(**kwargs)
127+
response = self.session.post(
128+
url=url,
129+
headers=headers,
130+
json=data,
131+
params=params,
132+
)
129133
elif method.upper() == "DELETE":
130-
response = self.session.delete(**kwargs)
134+
response = self.session.delete(
135+
url=url,
136+
headers=headers,
137+
json=data,
138+
params=params,
139+
)
131140
else:
132141
raise ValueError(f"Unsupported HTTP method: {method}")
133142

0 commit comments

Comments
 (0)