Repository: incubator-airflow Updated Branches: refs/heads/master 89dc50158 -> f0db42c62
[AIRFLOW-480] Support binary file download from GCS Allow for binary file download from Google Cloud Storage Closes #1793 from al- xv/feature/allow_binary_input_gcs_hook Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/f0db42c6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/f0db42c6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/f0db42c6 Branch: refs/heads/master Commit: f0db42c62799192eb053d1ef946f722f47ae4ea8 Parents: 89dc501 Author: Alexander Volkmann <al...@gmx.de> Authored: Thu Sep 29 15:54:57 2016 -0700 Committer: Siddharth Anand <siddharthan...@yahoo.com> Committed: Thu Sep 29 15:55:07 2016 -0700 ---------------------------------------------------------------------- airflow/contrib/hooks/gcs_hook.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/f0db42c6/airflow/contrib/hooks/gcs_hook.py ---------------------------------------------------------------------- diff --git a/airflow/contrib/hooks/gcs_hook.py b/airflow/contrib/hooks/gcs_hook.py index 83af477..0bbecba 100644 --- a/airflow/contrib/hooks/gcs_hook.py +++ b/airflow/contrib/hooks/gcs_hook.py @@ -59,7 +59,8 @@ class GoogleCloudStorageHook(GoogleCloudBaseHook): # Write the file to local file path, if requested. if filename: - with open(filename, 'w') as file_fd: + write_argument = 'wb' if isinstance(downloaded_file_bytes, bytes) else 'w' + with open(filename, write_argument) as file_fd: file_fd.write(downloaded_file_bytes) return downloaded_file_bytes