Skip to content

Commit 6206df4

Browse files
authored
Added urllib3 version check (#547)
* Added version check * Removed packaging
1 parent f9b7f43 commit 6206df4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/databricks/sql/auth/retry.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import random
33
import time
44
import typing
5+
from importlib.metadata import version
56
from enum import Enum
67
from typing import List, Optional, Tuple, Union
78

@@ -16,7 +17,6 @@
1617
from urllib3 import HTTPResponse as BaseHTTPResponse
1718
from urllib3 import Retry
1819
from urllib3.util.retry import RequestHistory
19-
from packaging import version
2020

2121

2222
from databricks.sql.exc import (
@@ -312,7 +312,9 @@ def get_backoff_time(self) -> float:
312312

313313
current_attempt = self.stop_after_attempts_count - int(self.total or 0)
314314
proposed_backoff = (2**current_attempt) * self.delay_min
315-
if version.parse(urllib3.__version__) >= version.parse("2.0.0"):
315+
316+
library_version = version("urllib3")
317+
if int(library_version.split(".")[0]) >= 2:
316318
if self.backoff_jitter != 0.0:
317319
proposed_backoff += random.random() * self.backoff_jitter
318320

0 commit comments

Comments
 (0)