Beispiel #1
0
def handle_message(event):

    # ユーザからの検索ワードを取得
    word = event.message.text

    # 記事取得関数を呼び出し
    result = sc.getNews(word)

    # 応答メッセージ(記事検索結果)を送信
    line_bot_api.reply_message(event.reply_token, TextSendMessage(text=result))
Beispiel #2
0
def handle_message(event):

    word = event.message.text
    result = sc.getNews(word)

    line_bot_api.reply_message(event.reply_token, TextSendMessage(text=result))
Beispiel #3
0
from linebot import LineBotApi
from linebot.models import TextSendMessage
from linebot.exceptions import LineBotApiError
import os
import scrape

ACCESS_TOKEN = os.environ['ENV_ACCESS_TOKEN']
USER_ID = os.environ['ENV_USER_ID']

line_bot_api = LineBotApi(ACCESS_TOKEN)

result = scrape.getNews("浦和")

try:
    line_bot_api.push_message(USER_ID, TextSendMessage(text=result))
    print("成功です")
except LineBotApiError as e:
    print("エラーです")
Beispiel #4
0
def news():
    if request.method == 'GET':
        return jsonify(getNews(request.args.get('category')))