Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions smartsheet/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@

class _SSLAdapter(HTTPAdapter):
def create_ssl_context(self):
ctx = ssl.create_default_context()
ctx.options |= ssl.OP_NO_SSLv2
ctx.options |= ssl.OP_NO_SSLv3
ctx.options |= ssl.OP_NO_TLSv1
ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
ctx.minimum_version = ssl.TLSVersion.TLSv1_2
return ctx

def init_poolmanager(self, connections, maxsize, block=False):
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/test_ssl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import unittest
import warnings
import ssl
from smartsheet.session import _SSLAdapter

class TestSSLContext(unittest.TestCase):

def test_no_deprecation_warning(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
adapter = _SSLAdapter()
context = adapter.create_ssl_context()
self.assertEqual(len(w), 0, "Deprecation warning was raised")

if __name__ == "__main__":
unittest.main()