Skip to content

Commit 36724cf

Browse files
julien-langCopilot
andauthored
SG-40026 Renove unused CACertsHTTPSConnection class (#418)
* Renove unused CACertsHTTPSConnection class Should have been removed in #372 * Update shotgun_api3/shotgun.py Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent c7c3bc7 commit 36724cf

File tree

2 files changed

+4
-39
lines changed

2 files changed

+4
-39
lines changed

shotgun_api3/shotgun.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4382,7 +4382,7 @@ def _upload_data_to_storage(self, data, content_type, size, storage_url):
43824382
else:
43834383
break
43844384
else:
4385-
raise ShotgunError("Max attemps limit reached.")
4385+
raise ShotgunError("Max attempts limit reached.")
43864386

43874387
etag = result.info()["Etag"]
43884388
LOG.debug("Part upload completed successfully.")
@@ -4502,42 +4502,7 @@ def _send_form(self, url, params):
45024502

45034503
return result
45044504
else:
4505-
raise ShotgunError("Max attemps limit reached.")
4506-
4507-
4508-
class CACertsHTTPSConnection(http.client.HTTPConnection):
4509-
""" "
4510-
This class allows to create an HTTPS connection that uses the custom certificates
4511-
passed in.
4512-
"""
4513-
4514-
default_port = http.client.HTTPS_PORT
4515-
4516-
def __init__(self, *args, **kwargs):
4517-
"""
4518-
:param args: Positional arguments passed down to the base class.
4519-
:param ca_certs: Path to the custom CA certs file.
4520-
:param kwargs: Keyword arguments passed down to the bas class
4521-
"""
4522-
# Pop that argument,
4523-
self.__ca_certs = kwargs.pop("ca_certs")
4524-
super().__init__(self, *args, **kwargs)
4525-
4526-
def connect(self):
4527-
"Connect to a host on a given (SSL) port."
4528-
super().connect(self)
4529-
# Now that the regular HTTP socket has been created, wrap it with our SSL certs.
4530-
if (sys.version_info.major, sys.version_info.minor) >= (3, 8):
4531-
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
4532-
context.verify_mode = ssl.CERT_REQUIRED
4533-
context.check_hostname = False
4534-
if self.__ca_certs:
4535-
context.load_verify_locations(self.__ca_certs)
4536-
self.sock = context.wrap_socket(self.sock)
4537-
else:
4538-
self.sock = ssl.wrap_socket(
4539-
self.sock, ca_certs=self.__ca_certs, cert_reqs=ssl.CERT_REQUIRED
4540-
)
4505+
raise ShotgunError("Max attempts limit reached.")
45414506

45424507

45434508
# Helpers from the previous API, left as is.

tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ def test_upload_s3_urlerror__get_attachment_upload_info(self):
523523

524524
# Test the exception message
525525
the_exception = cm.exception
526-
self.assertEqual(str(the_exception), "Max attemps limit reached.")
526+
self.assertEqual(str(the_exception), "Max attempts limit reached.")
527527

528528
def test_upload_s3_urlerror__upload_to_storage(self):
529529
"""
@@ -557,7 +557,7 @@ def test_upload_s3_urlerror__upload_to_storage(self):
557557

558558
# Test the exception message
559559
the_exception = cm.exception
560-
self.assertEqual(str(the_exception), "Max attemps limit reached.")
560+
self.assertEqual(str(the_exception), "Max attempts limit reached.")
561561

562562
def test_transform_data(self):
563563
"""Outbound data is transformed"""

0 commit comments

Comments
 (0)