뷰티풀수프로 크롤링한 내용을 플라스크 앱을 통해 카카오 옐로아이디(플러스친구)에 연결하고 싶습니다.
조회수 1263회
뷰티풀 수프를 이용해 크롤링은 잘 되었고, 하나의 파이썬 파일로 존재합니다.
또한 아래와 같이 플라스크를 이용해서 기본 API 테스트는 성공했습니다.
#encoding = utf-8
import os
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.route('/')
def Welcome():
return app.send_static_file('index.html')
@app.route('/keyboard')
def Keyboard():
keyList= ["A","B","C"]
keyboardList = {'type': 'buttons', 'buttons': keyList}
return jsonify(keyboardList)
@app.route('/message', methods=['POST'])
def message():
content = request.get_json()
messageList = [
{
"message":{
"text": "Hello"},
"keyboard":
{"type": "buttons",
"buttons": ["A","B","C"]}
}
]
return jsonify(content)
port = os.getenv('PORT', '5000')
if __name__ == "__main__":
app.run(host='0.0.0.0', port=int(port))
서버는 IBM 블루스택을 이용했는데, 크롤링 내용을 담고 있는 파일 1과 키보드에 따른 리턴값을 받는 파일2를 합치는 방법이 궁금합니다..
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력