import os, sys BASE_DIR = os.path.dirname(os.path.abspath("API")) sys.path.extend([BASE_DIR]) import pymysql from flask import Blueprint, jsonify, request from jsonschema import validate, ValidationError from datetime import datetime from connections import db_connector from models import ModelDao from decorator import login_required diary_app = Blueprint("diary", __name__) model_dao = ModelDao() #이모티콘 정보 보내주기 @diary_app.route('/emotion', methods=['GET']) def emotion(): db = None try: db = db_connector() if db is None: return jsonify(message="DATABASE_INIT_ERROR"), 500 data = model_dao.search_emotion(db) return jsonify(emotion=data), 200 except Exception as e:
BASE_DIR = os.path.dirname(os.path.abspath("API")) sys.path.extend([BASE_DIR]) import jwt import pymysql import bcrypt from flask import Blueprint, jsonify, request from jsonschema import validate, ValidationError from connections import db_connector from my_settings import SECRET_KEY, ALGORITHM from models import ModelDao user_app = Blueprint('user', __name__) model_dao = ModelDao() @user_app.route('/kakao', methods=['POST']) def kakao(): """ kakao 로그인 API """ db = None try: token = request.headers['Authorization'] nickname = request.get_json(silent=True).get('nickname', None) if not token: return jsonify(message="TOKEN_DOES_NOT_EXIST"), 400 data = request.get('https://kapi.kakao.com/v2/user/me', headers={'Authorization':f'Bearer {token}'})