I am new to python. I got this pre written code that downloads data in to report. But I am getting the error
"write() argument must be str, not bytes".
See below code
def _download_report(service, response, ostream):
logger.info('Downloading keyword report')
written_header = False
for fragment in range(len(response.files)):
file_request = service.reports().getFile(
reportId=response.id_, reportFragment=fragment)
istream = io.BytesIO(file_request.execute())
if written_header:
istream.readline()
else:
written_header = True
ostream.write(istream.read())