Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/kagglesdk/kaggle_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
KaggleEnv,
)
from kagglesdk.kaggle_object import KaggleObject
from kagglesdk.common.types.file_download import FileDownload
from kagglesdk.common.types.http_redirect import HttpRedirect
from typing import Type

# TODO (http://b/354237483) Generate the client from the existing one.
Expand Down Expand Up @@ -81,6 +83,12 @@ def call(

# Merge environment settings into session
settings = self._session.merge_environment_settings(http_request.url, {}, None, None, None)

# Use stream=True for file downloads to avoid loading entire file into memory
# See: https://github.com/Kaggle/kaggle-api/issues/754
if response_type is not None and (response_type == FileDownload or response_type == HttpRedirect):
settings['stream'] = True

http_response = self._session.send(http_request, **settings)

response = self._prepare_response(response_type, http_response)
Expand Down