def get_data_as_chunks(self): """Return content as a list of strings, each corresponding to a chunk. Uncompresses the chunks, if needed. """ content_type = self.get_header('content-type') if (not content_type or not (content_type.startswith('text/') or content_type == 'application/x-javascript' or content_type.startswith('application/json'))): return None if self.is_compressed(): return httpzlib.uncompress_chunks(self.response_data, self.is_gzip()) else: return self.response_data
def get_data_as_text(self): """Return content as a single string. Uncompresses and concatenates chunks with CHUNK_EDIT_SEPARATOR. """ content_type = self.get_header('content-type') if (not content_type or not (content_type.startswith('text/') or content_type == 'application/x-javascript')): return None if self.is_compressed(): uncompressed_chunks = httpzlib.uncompress_chunks( self.response_data, self.is_gzip()) else: uncompressed_chunks = self.response_data return self.CHUNK_EDIT_SEPARATOR.join(uncompressed_chunks)