def connect(self): try: self.ws.connect(self.uri) except websocket.WebSocketException: raise MachineUnauthorizedError()