Skip to content

Commit 0da2b22

Browse files
sfc-gh-stakedaankit-bhatnagar167
authored andcommitted
SNOW-93078: remove dependecy on botocore requests. updated with botocore, boto3 and requests to the latest. SNOW-110891: pin stable version of Azure packages
1 parent 63d182e commit 0da2b22

File tree

5 files changed

+27
-24
lines changed

5 files changed

+27
-24
lines changed

network.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
from threading import Lock
1818

1919
import OpenSSL.SSL
20-
from botocore.vendored import requests
21-
from botocore.vendored.requests.adapters import HTTPAdapter
22-
from botocore.vendored.requests.auth import AuthBase
23-
from botocore.vendored.requests.exceptions import (
20+
import requests
21+
from requests.adapters import HTTPAdapter
22+
from requests.auth import AuthBase
23+
from requests.exceptions import (
2424
ConnectionError, ConnectTimeout, ReadTimeout, SSLError)
25-
from botocore.vendored.requests.packages.urllib3.exceptions import (
25+
from requests.packages.urllib3.exceptions import (
2626
ProtocolError, ReadTimeoutError)
2727

2828
from snowflake.connector.time_util import get_time_millis

ocsp_snowflake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ def _lazy_read_ca_bundle(self):
12211221
self.read_cert_bundle(ca_bundle)
12221222
else:
12231223
import sys
1224-
from botocore.vendored.requests import certs
1224+
from requests import certs
12251225
if hasattr(certs, '__file__') and \
12261226
path.exists(certs.__file__) and \
12271227
path.exists(path.join(

setup.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@ def _get_pyarrow_lib_pattern(self, lib_name):
157157
python_requires='>=2.7.9,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
158158

159159
install_requires=[
160-
'azure-common',
161-
'azure-storage-blob',
162-
'boto3>=1.4.4,<1.10.0',
163-
'botocore>=1.5.0,<1.13.0',
160+
'azure-common<2.0.0',
161+
'azure-storage-blob<12.0.0',
162+
'boto3>=1.4.4,<1.11.0',
163+
'botocore>=1.5.0,<1.14.0',
164+
'requests<2.23.0',
165+
'urllib3<1.25.0',
164166
'certifi',
165167
'future',
166168
'six',

ssl_wrap_socket.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
from socket import (socket, timeout)
2929

3030
import OpenSSL.SSL
31-
from botocore.vendored.requests.packages.urllib3 import connection \
32-
as urllib3_connection
33-
from botocore.vendored.requests.packages.urllib3 import util \
34-
as urllib3_util
31+
3532
from cryptography import x509
3633
from cryptography.hazmat.backends.openssl import backend as openssl_backend
3734
from cryptography.hazmat.backends.openssl.x509 import _Certificate
3835

36+
import requests.packages.urllib3.util.ssl_ as ssl_
37+
import requests.packages.urllib3.connection as connection_
38+
3939
from .compat import PY2
4040
from .errorcode import (ER_SERVER_CERTIFICATE_REVOKED)
4141
from .errors import (OperationalError)
@@ -84,7 +84,7 @@ def inject_into_urllib3():
8484
Monkey-patch urllib3 with PyOpenSSL-backed SSL-support and OCSP.
8585
"""
8686
log.debug(u'Injecting ssl_wrap_socket_with_ocsp')
87-
urllib3_connection.ssl_wrap_socket = ssl_wrap_socket_with_ocsp
87+
connection_.ssl_wrap_socket = ssl_wrap_socket_with_ocsp
8888

8989

9090
def _dnsname_to_stdlib(name):
@@ -310,7 +310,7 @@ def makefile(self, mode, bufsize=-1):
310310

311311
WrappedSocket.makefile = makefile
312312

313-
DEFAULT_SSL_CIPHER_LIST = urllib3_util.ssl_.DEFAULT_CIPHERS
313+
DEFAULT_SSL_CIPHER_LIST = ssl_.DEFAULT_CIPHERS
314314
if isinstance(DEFAULT_SSL_CIPHER_LIST, str):
315315
DEFAULT_SSL_CIPHER_LIST = DEFAULT_SSL_CIPHER_LIST.encode('utf-8')
316316

@@ -368,12 +368,13 @@ def _verify_callback(cnx, x509, err_no, err_depth, return_code):
368368

369369

370370
def ssl_wrap_socket_with_ocsp(
371-
sock, keyfile=None, certfile=None, cert_reqs=None,
372-
ca_certs=None, server_hostname=None, ssl_version=None):
373-
ret = ssl_wrap_socket(
374-
sock, keyfile=keyfile, certfile=certfile, cert_reqs=cert_reqs,
375-
ca_certs=ca_certs, server_hostname=server_hostname,
376-
ssl_version=ssl_version)
371+
sock, keyfile=None, certfile=None, ca_certs=None,
372+
ca_cert_dir=None, server_hostname=None, ssl_context=None):
373+
374+
ret = ssl_.ssl_wrap_socket(
375+
sock, keyfile=keyfile, certfile=certfile,
376+
ca_certs=ca_certs, ca_cert_dir=ca_cert_dir,
377+
server_hostname=server_hostname)
377378
global FEATURE_OCSP_MODE
378379
global FEATURE_OCSP_RESPONSE_CACHE_FILE_NAME
379380

test/test_unit_retry_network.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
import OpenSSL.SSL
1515
import pytest
16-
from botocore.vendored.requests.exceptions import (
16+
from requests.exceptions import (
1717
ConnectionError, ConnectTimeout, ReadTimeout, SSLError)
18-
from botocore.vendored.requests.packages.urllib3.exceptions import (
18+
from requests.packages.urllib3.exceptions import (
1919
ProtocolError, ReadTimeoutError)
2020

2121
from snowflake.connector.compat import (

0 commit comments

Comments
 (0)