From fa6ed6f31842490b666b04606a994b661a27c7b4 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Thu, 12 Oct 2023 14:55:01 -0600 Subject: [PATCH] Test fix for security scanner --- src/epplibwrapper/__init__.py | 3 +++ src/epplibwrapper/client.py | 2 ++ src/epplibwrapper/socket.py | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/epplibwrapper/__init__.py b/src/epplibwrapper/__init__.py index dd6664a3a..5b3bdc55c 100644 --- a/src/epplibwrapper/__init__.py +++ b/src/epplibwrapper/__init__.py @@ -45,6 +45,9 @@ except NameError: # Attn: these imports should NOT be at the top of the file try: from .client import CLIENT, commands +except ImportError: + pass +try: from .errors import RegistryError, ErrorCode from epplib.models import common, info from epplib.responses import extensions diff --git a/src/epplibwrapper/client.py b/src/epplibwrapper/client.py index 1bbda80e7..3426dd486 100644 --- a/src/epplibwrapper/client.py +++ b/src/epplibwrapper/client.py @@ -74,6 +74,8 @@ class EPPLibWrapper: } self._pool = None + # Since we reuse the same creds for each pool, we can test on + # one socket, and if successful, then we know we can connect. if not settings.DEBUG or self._test_registry_connection_success(): self._pool = EppConnectionPool( client=self._client, login=self._login, options=options diff --git a/src/epplibwrapper/socket.py b/src/epplibwrapper/socket.py index d25d823f1..c6ffe20bf 100644 --- a/src/epplibwrapper/socket.py +++ b/src/epplibwrapper/socket.py @@ -42,7 +42,8 @@ class Socket: return code >= 2000 def test_connection_success(self): - """Tests if a successful connection can be made with the registry""" + """Tests if a successful connection can be made with the registry. + Tries 3 times""" # Something went wrong if this doesn't exist if not hasattr(self.client, "connect"): return False