diff --git a/adafruit_minimqtt/adafruit_minimqtt.py b/adafruit_minimqtt/adafruit_minimqtt.py index eee1f3a0..b3677586 100755 --- a/adafruit_minimqtt/adafruit_minimqtt.py +++ b/adafruit_minimqtt/adafruit_minimqtt.py @@ -203,6 +203,7 @@ def __init__( self.on_subscribe = None self.on_unsubscribe = None + # pylint: disable=too-many-branches def _get_connect_socket(self, host, port, *, timeout=1): """Obtains a new socket and connects to a broker. :param str host: Desired broker hostname @@ -222,6 +223,9 @@ def _get_connect_socket(self, host, port, *, timeout=1): if self._ssl_context is None: self._ssl_context = _fake_context + if not isinstance(port, int): + raise RuntimeError("Port must be an integer") + if port == 8883 and not self._ssl_context: raise RuntimeError( "ssl_context must be set before using adafruit_mqtt for secure MQTT."