Uploads the given string to S3 blob storage service. :param blob_path: the blob path where the file will be uploaded in the bucket :param string_data: the string data to upload :param content_type: content type of the string data :param bucket_type: the D
(self,
blob_path: str,
string_data: str,
content_type: str,
bucket_type: str = "web")
| 188 | ExtraArgs = {'ContentType': content_type}) |
| 189 | |
| 190 | def upload_from_string(self, |
| 191 | blob_path: str, |
| 192 | string_data: str, |
| 193 | content_type: str, |
| 194 | bucket_type: str = "web"): |
| 195 | """ |
| 196 | Uploads the given string to S3 blob storage service. |
| 197 | :param blob_path: the blob path where the file will be uploaded in the bucket |
| 198 | :param string_data: the string data to upload |
| 199 | :param content_type: content type of the string data |
| 200 | :param bucket_type: the Diffgram bucket type (either 'web' or 'ml'). Defaults to 'web' |
| 201 | :return: None |
| 202 | """ |
| 203 | if bucket_type == "web": |
| 204 | bucket_name = self.s3_bucket_name |
| 205 | |
| 206 | if bucket_type == "ml": |
| 207 | bucket_name = self.s3_bucket_name_ml |
| 208 | |
| 209 | self.s3_client.put_object(Body = string_data, |
| 210 | Bucket = bucket_name, |
| 211 | Key = blob_path, |
| 212 | ContentType = content_type) |
| 213 | |
| 214 | def download_bytes(self, blob_path: str): |
| 215 | """ |
no outgoing calls
no test coverage detected