Spaces:
Runtime error
Runtime error
File size: 533 Bytes
342d3dd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import os
from dotenv import load_dotenv
import boto3
load_dotenv(dotenv_path=".env")
def s3session():
session = boto3.session.Session(
aws_access_key_id=os.environ.get("ACCESS_KEY_ID"),
aws_secret_access_key=os.environ.get("SECRET_ACCESS_KEY"),
)
return session
def s3client():
session = s3session()
s3_client = session.client("s3")
return s3_client
def s3resource():
session = s3session()
s3_resource = session.resource("s3")
return s3_resource
|