Skip to content

Commit b8bb91f

Browse files
fix old driver import
1 parent 43de060 commit b8bb91f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

test/csp_helpers.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@
55
import os
66
from abc import ABC, abstractmethod
77
from time import time
8-
from typing import TYPE_CHECKING
98
from unittest import mock
109
from unittest.mock import patch
1110
from urllib.parse import parse_qs, urlparse
1211

1312
import jwt
1413

15-
from snowflake.connector.options import botocore, installed_boto
16-
17-
if TYPE_CHECKING:
14+
# Old driver does not install boto
15+
try:
1816
from botocore.awsrequest import AWSRequest
17+
from botocore.credentials import Credentials
18+
19+
installed_boto = True
20+
except ImportError:
21+
AWSRequest = None
22+
Credentials = None
23+
installed_boto = False
24+
1925

2026
from snowflake.connector.vendored.requests.exceptions import ConnectTimeout, HTTPError
2127
from snowflake.connector.vendored.requests.models import Response
@@ -380,9 +386,7 @@ def __init__(self):
380386

381387
self.caller_identity = {"Arn": self.arn}
382388
self.region = "us-east-1"
383-
self.credentials = botocore.credentials.Credentials(
384-
access_key="ak", secret_key="sk"
385-
)
389+
self.credentials = Credentials(access_key="ak", secret_key="sk")
386390
self.instance_document = (
387391
b'{"region": "us-east-1", "instanceId": "i-1234567890abcdef0"}'
388392
)

0 commit comments

Comments
 (0)