edited environment and made it into a class

This commit is contained in:
MayDay9939 2023-10-27 15:42:05 +08:00
parent ea19abb95c
commit 3793721a7f
1 changed files with 5 additions and 2 deletions

View File

@ -1,10 +1,13 @@
import os import os
import boto3 import boto3
from dotenv import load_dotenv import environ
def initialize_s3_client(): def initialize_s3_client():
# Load environment variables from .env file # Load environment variables from .env file
load_dotenv() env_path = os.path.join('safeshare', 'env')
# Load environment variables from the .env file
environ.Env.read_env(env_path)
# Access AWS credentials # Access AWS credentials
aws_key = os.getenv('AWS_ACCESS_KEY_ID') aws_key = os.getenv('AWS_ACCESS_KEY_ID')