Вы загружаете полный ответ на свой сервер перед передачей информации.
Вы должны просто переслать ответ от вызова API, используя следующее:
res = FROM API CALL
response = HttpResponse(ContentFile(res.content), 'application/zip')
response['Content-Disposition'] = 'attachment; filename={}.zip'.format(patient_id)
response['Content-Length'] = res.headers.get('Content-Length')
response['Content-Transfer-Encoding'] = res.headers.get('Content-Transfer-Encoding')
response['Content-Type'] = res.headers.get('Content-Type')
return response
Убедитесь, что вы скопировали все важные заголовки.
Редактировать: поскольку это единственное предлагаемое решение, я редактирую, чтобы включить решение из комментария Джона в более читаемый формат:
# Make api call
response = requests.get(url, cookies=dict(JSESSIONID=self.session_id), stream=True)
# write bytes to Http Response
http = StreamingHttpResponse(response.iter_content(8096), content_type='application/zip')
http['Content-Disposition'] = 'attachment; filename="%s.zip"' % patient_id
return http