fix: add support for iter_bytes when iter_content is unavailable in simulation save service

main
Cizz22 3 months ago
parent a4105ea7cf
commit 2e05a326a1

@ -40,8 +40,12 @@ async def execute_simulation(
) )
response.raise_for_status() response.raise_for_status()
with open(tmpfile, "wb") as f: with open(tmpfile, "wb") as f:
for chunk in response.iter_content(chunk_size=8192): if hasattr(response, "iter_content"):
f.write(chunk) for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)
else:
for chunk in response.iter_bytes(chunk_size=8192):
f.write(chunk)
if not is_saved: if not is_saved:
# If not saving to DB, just return parsed JSON # If not saving to DB, just return parsed JSON

Loading…
Cancel
Save