Skip to content

Commit

Permalink
test : 주석
Browse files Browse the repository at this point in the history
갑자기 server 안되서 주석처리
  • Loading branch information
sycuuui committed Mar 21, 2024
1 parent 18c992d commit 6b41d85
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
32 changes: 16 additions & 16 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from flask import (Flask, jsonify)
from connection import s3_connection
import os
# from connection import s3_connection
# import os

app = Flask(__name__)

Expand All @@ -22,20 +22,20 @@ def test2(): # put application's code here
def test3(): # put application's code here
return 'post test3'

@app.route('/image', methods=['POST'])
def test_image():
s3 = s3_connection()
try:
with open('dd.jpeg', 'rb') as image_file:
s3.put_object(
Bucket=os.getenv('BUCKET_NAME'),
Body=image_file,
Key='dd.jpeg',
ContentType='image/jpeg'
)
return jsonify({'success': True})
except Exception as e:
return jsonify({'error': str(e)})
# @app.route('/image', methods=['POST'])
# def test_image():
# s3 = s3_connection()
# try:
# with open('dd.jpeg', 'rb') as image_file:
# s3.put_object(
# Bucket=os.getenv('BUCKET_NAME'),
# Body=image_file,
# Key='dd.jpeg',
# ContentType='image/jpeg'
# )
# return jsonify({'success': True})
# except Exception as e:
# return jsonify({'error': str(e)})

if __name__ == '__main__':
app.run(host='0.0.0.0', port='5000')
18 changes: 9 additions & 9 deletions connection.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import boto3
import os


def s3_connection():
s3 = boto3.client('s3',
aws_access_key_id=os.getenv('AWS_ACCESS_KEY'),
aws_secret_access_key=os.getenv('AWS_SECRET_KEY'))
return s3
# import boto3
# import os
#
#
# def s3_connection():
# s3 = boto3.client('s3',
# aws_access_key_id=os.getenv('AWS_ACCESS_KEY'),
# aws_secret_access_key=os.getenv('AWS_SECRET_KEY'))
# return s3

0 comments on commit 6b41d85

Please sign in to comment.