Move push to bucket in actions.py

pull/715/head
Andrey 2022-11-24 14:42:52 +02:00
rodzic e8a1187889
commit 3800c558b8
1 zmienionych plików z 22 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,22 @@
import logging
from typing import Any, Dict
import boto3 # type: ignore
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def push_data_to_bucket(
data: Any, key: str, bucket: str, metadata: Dict[str, Any] = {}
) -> None:
s3 = boto3.client("s3")
s3.put_object(
Body=data,
Bucket=bucket,
Key=key,
ContentType="application/json",
Metadata=metadata,
)
logger.info(f"Data pushed to bucket: s3://{bucket}/{key}")