diff --git a/kuryr_kubernetes/k8s_client.py b/kuryr_kubernetes/k8s_client.py index de555624f..60295b98b 100644 --- a/kuryr_kubernetes/k8s_client.py +++ b/kuryr_kubernetes/k8s_client.py @@ -197,7 +197,7 @@ class K8sClient(object): headers=header)) as response: if not response.ok: raise exc.K8sClientException(response.text) - for line in response.iter_lines(delimiter='\n'): - line = line.strip() + for line in response.iter_lines(): + line = line.decode('utf-8').strip() if line: yield jsonutils.loads(line) diff --git a/kuryr_kubernetes/tests/unit/test_k8s_client.py b/kuryr_kubernetes/tests/unit/test_k8s_client.py index acd8cd1c2..b98f5f022 100644 --- a/kuryr_kubernetes/tests/unit/test_k8s_client.py +++ b/kuryr_kubernetes/tests/unit/test_k8s_client.py @@ -311,7 +311,7 @@ class TestK8sClient(test_base.TestCase): def test_watch(self, m_get): path = '/test' data = [{'obj': 'obj%s' % i} for i in range(3)] - lines = [jsonutils.dumps(i) for i in data] + lines = [jsonutils.dump_as_bytes(i) for i in data] m_resp = mock.MagicMock() m_resp.ok = True