Skip to content

Commit d28a692

Browse files
author
Jesse
authored
Make backwards compatible with urllib3~=1.0 (#197)
Signed-off-by: Jesse Whitehouse <[email protected]>
1 parent 7aaa014 commit d28a692

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ numpy = [
2929
sqlalchemy = "^1.3.24"
3030
openpyxl = "^3.0.10"
3131
alembic = "^1.0.11"
32-
urllib3 = "^2.0.0"
32+
urllib3 = ">=1.0"
3333

3434
[tool.poetry.dev-dependencies]
3535
pytest = "^7.1.2"

src/databricks/sql/auth/retry.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
from enum import Enum
55
from typing import List, Optional, Tuple, Union
66

7-
from urllib3 import BaseHTTPResponse # type: ignore
7+
# We only use this import for type hinting
8+
try:
9+
# If urllib3~=2.0 is installed
10+
from urllib3 import BaseHTTPResponse # type: ignore
11+
except ImportError:
12+
# If urllib3~=1.0 is installed
13+
from urllib3 import HTTPResponse as BaseHTTPResponse
814
from urllib3 import Retry
915
from urllib3.util.retry import RequestHistory
1016

0 commit comments

Comments
 (0)