From 9dba5daecdca58a20bbcd28a0927e496afcca641 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Wed, 10 Jul 2024 17:26:11 -0500 Subject: [PATCH] bug fix, TODO: figure out how to parse types --- transport/cloud/s3.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/transport/cloud/s3.py b/transport/cloud/s3.py index 095cfd3..4b4515d 100644 --- a/transport/cloud/s3.py +++ b/transport/cloud/s3.py @@ -117,15 +117,18 @@ class Writer(s3) : """ This function will write the data to the s3 bucket, files can be either csv, or json formatted files """ + content = 'text/plain' if type(_data) == pd.DataFrame : _stream = _data.to_csv(index=False) + content = 'text/csv' elif type(_data) == dict : _stream = json.dumps(_data) + content = 'application/json' else: _stream = _data file = StringIO(_stream) bucket = self._bucket_name if 'bucket' not in _args else _args['bucket'] file_name = self._file_name if 'file' not in _args else _args['file'] - self._client.put_object(Bucket=bucket, Key = file_name, Body=_stream) + self._client.put_object(Bucket=bucket, Key = file_name, Body=_stream,ContentType=content) pass