Skip to content

Commit

Permalink
suppress pyopenssl deprecation warning with catch_warnings (#2763)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlm6693 authored Sep 22, 2022
1 parent 3b08f37 commit 87eba48
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions botocore/httpsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os.path
import socket
import sys
import warnings
from base64 import b64encode

from urllib3 import PoolManager, Timeout, proxy_from_url
Expand Down Expand Up @@ -37,8 +38,14 @@
from ssl import OP_NO_TICKET, PROTOCOL_TLS_CLIENT

try:
# Always import the original SSLContext, even if it has been patched
from urllib3.contrib.pyopenssl import orig_util_SSLContext as SSLContext
# pyopenssl will be removed in urllib3 2.0, we'll fall back to ssl_ at that point.
# This can be removed once our urllib3 floor is raised to >= 2.0.
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=DeprecationWarning)
# Always import the original SSLContext, even if it has been patched
from urllib3.contrib.pyopenssl import (
orig_util_SSLContext as SSLContext,
)
except ImportError:
from urllib3.util.ssl_ import SSLContext

Expand Down

0 comments on commit 87eba48

Please sign in to comment.