From 6b41d8543854507ce0dec0438a8c31c24e41dd7d Mon Sep 17 00:00:00 2001 From: sycuuui <102959791+sycuuui@users.noreply.github.com> Date: Thu, 21 Mar 2024 19:02:13 +0900 Subject: [PATCH] =?UTF-8?q?test=20:=20=EC=A3=BC=EC=84=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 갑자기 server 안되서 주석처리 --- app.py | 32 ++++++++++++++++---------------- connection.py | 18 +++++++++--------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app.py b/app.py index d82d414..e56a5e3 100644 --- a/app.py +++ b/app.py @@ -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__) @@ -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') diff --git a/connection.py b/connection.py index 5d57ba5..e6bb7c6 100644 --- a/connection.py +++ b/connection.py @@ -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