def test_url_risklist(self): client = ConnectApiClient() resp = client.get_url_risklist(gzip=False) itr = resp.iter_lines() header = next(itr) self.assertIsInstance(header, basestring) entries = list(itr) self.assertGreater(len(entries), 10)
def test_url_risklist_gzip(self): """download gzip and write to a byte buffer""" client = ConnectApiClient() resp = client.get_url_risklist(gzip=True) buf = io.BytesIO() for itr in resp.iter_content(chunk_size=1024): buf.write(itr) buf.seek(0) self.assertGreater(len(buf.read()), 1000) buf.close()