def _send_loop(self): while True: command = force_bytes(self._send_queue.get()) try: self._socket.sendall(command) except Exception: eventlet.spawn(self.reconnect) return
def _send_loop(self): while True: command = force_bytes(self._send_queue.get()) self.logger.debug('send: %r', command[:-2]) try: self._socket.sendall(command) except Exception: self.logger.exception("Client._send_loop failed") gevent.spawn(self.reconnect) return
def test_force_bytes_b(self): self.assertTrue(isinstance(force_bytes(b"HELLO"), str))
def test_force_bytes_u(self): self.assertTrue(isinstance(force_bytes(u"HELLO"), bytes))