def webhook(): if request.method == 'POST': pp = pprint.PrettyPrinter(indent=3) ### dictionary from line data = request.json #type เป็น dictionary print(type(data)) data_show = pp.pprint(data) ## extract text from line text_fromline = data['events'][0]['message']['text'] ## ค้นหาคำจาก wikipedia result = search_wiki(text_fromline) ### import function ในการส่งmessage reply.py from reply import ReplyMessage ReplyMessage(Reply_token=data['events'][0]['replyToken'], TextMessage=result, Line_Acees_Token=access_token) return 'OK' elif request.method == 'GET': return 'นี้คือลิงค์เว็บสำหรับรับ package'
def webhook(): if request.method == 'POST': pp = pprint.PrettyPrinter(indent=3) ### dictionary from line data = request.json data_show = pp.pprint(data) ## extract text from line text_fromline = data['events'][0]['message']['text'] ## ค้นหาคำจาก wikipedia result = search_wiki(text_fromline) ### import function ในการส่งmessage reply.py from reply import ReplyMessage ReplyMessage(Reply_token=data['events'][0]['replyToken'], TextMessage=result, Line_Acees_Token= '7am3KDdBRsl/TiNrPKEhb/43c4RQyaLV52hrxfmeHxQiGyBkOrObnDh9HGbLYcFEG4GAun7sbA6ksB8ncDqfnwu83CfxmfFjRPSb4GX7tbgbOZG/jaubZ5FyCnE407o+bR4LFtt1hlBcjK0CDwVP+gdB04t89/1O/w1cDnyilFU=' ) return 'OK' elif request.method == 'GET': return 'นี้คือลิงค์เว็บสำหรับรับ package'
def webhook(): if request.method == 'POST': pp = pprint.PrettyPrinter(indent=3) ### dictionary from line data = request.json pp.pprint(data) ## extract text from line if data['events'][0]['message']['type'] == "text": text_fromline = data['events'][0]['message']['text'] ## ค้นหาคำจาก wikipedia result = search_wiki(text_fromline) ### import function ในการส่งmessage reply.py from reply import ReplyMessage ReplyMessage( Reply_token=data['events'][0]['replyToken'], TextMessage=result, Line_Access_Token= 'fqUkl9Htr7LzDAExz0wjLy+b1vW04kQ9Jz82hIFyeB8h0NgeJcTOPezD5rPiwMY527NTkvuRnwnL+5XxW3nJ9hrFkXT9RV7vKuEUZMKif48HHKlDDOhIKju3UTRmEb5OPfIY2b1jar327csK8tHsBAdB04t89/1O/w1cDnyilFU=' ) return 'OK' elif request.method == 'GET': return 'นี้คือลิงค์เว็บสำหรับรับ package'
def webhook(): if request.method == 'POST': pp = pprint.PrettyPrinter(indent=3) ### dictionary from line data = request.json data_show = pp.pprint(data) ## extract text from line text_fromline = data['events'][0]['message']['text'] ## ค้นหาคำจาก wikipedia result = search_wiki(text_fromline) ### import function ในการส่งmessage reply.py from reply import ReplyMessage ReplyMessage( Reply_token=data['events'][0]['replyToken'], TextMessage=result, Line_Access_Token= 'SUoCA5pwOPSQ0LRMR2zuGeZTbg3nJtQJEGKVpTSTFJsgwuWfP6qPB06Pp179ar9lJayy6lvBaZBvqD+Ynx/sJqlzXo/4v0c6EMt7hsSWHCy1Q54vdjkfGb/ufXQi1bGPczfWuCLZPOe5jiette9uZwdB04t89/1O/w1cDnyilFU=' ) return 'OK' elif request.method == 'GET': return 'นี้คือลิงค์เว็บสำหรับรับ package'
def webhook(): if request.method == 'POST': pp = pprint.PrettyPrinter(indent=3) #dictionary from line data = request.json data_show = pp.pprint(data) print(data_show) text_fromline = data['events'][0]['message']['text'] result = search_wiki(text_fromline) print(result) from reply import ReplyMessage ReplyMessage(Reply_token=data['events'][0]['replyToken'], TextMessage=result, Line_Access_Token=access_token) return 'OK' elif request.method == 'GET': return 'this is web page for recieving package'