Browse Source

bug fix, TODO: figure out how to parse types

Steve Nyemba 1 year ago
parent
commit
9dba5daecd
1 changed files with 4 additions and 1 deletions
  1. 4 1
      transport/cloud/s3.py

+ 4 - 1
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
 		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 :
 		if type(_data) == pd.DataFrame :
 			_stream = _data.to_csv(index=False)
 			_stream = _data.to_csv(index=False)
+			content = 'text/csv'
 		elif type(_data) == dict :
 		elif type(_data) == dict :
 			_stream = json.dumps(_data)
 			_stream = json.dumps(_data)
+			content = 'application/json'
 		else:
 		else:
 			_stream = _data
 			_stream = _data
 		file = StringIO(_stream)
 		file = StringIO(_stream)
 		bucket = self._bucket_name if 'bucket' not in _args else _args['bucket']
 		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']
 		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
 		pass