-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
149 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import boto3 | ||
from botocore.exceptions import NoCredentialsError, PartialCredentialsError | ||
|
||
BUCKET_NAME = "sandol-bucket" | ||
FILE_KEY = "test.json" | ||
|
||
|
||
def get_s3_client(): | ||
return boto3.client('s3') | ||
|
||
|
||
def download_file_from_s3(bucket_name, file_key, download_path): | ||
s3 = get_s3_client() | ||
try: | ||
s3.download_file(bucket_name, file_key, download_path) | ||
except (NoCredentialsError, PartialCredentialsError): | ||
print("AWS 자격 증명이 필요합니다.") | ||
raise | ||
except s3.exceptions.NoSuchKey: | ||
print(f"{file_key} 파일을 찾을 수 없습니다.") | ||
raise FileNotFoundError(f"{file_key} 파일을 찾을 수 없습니다.") | ||
|
||
|
||
def upload_file_to_s3(file_path, bucket_name, file_key): | ||
s3 = get_s3_client() | ||
try: | ||
s3.upload_file(file_path, bucket_name, file_key) | ||
except (NoCredentialsError, PartialCredentialsError): | ||
print("AWS 자격 증명이 필요합니다.") | ||
raise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# get_meals.py | ||
|
||
import os | ||
import json | ||
from common import BUCKET_NAME, FILE_KEY, download_file_from_s3 | ||
|
||
|
||
class Restaurant: | ||
@staticmethod | ||
def by_dict(data): | ||
# 데이터 처리 로직 (예시) | ||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.