from django.shortcuts import render
from django.http import HttpResponse
import os
import json
import requests

REPLY_ENDPOINT = 'https://api.line.me/v2/bot/message/reply'
CHANNEL_ACCESS_TOKEN = os.environ['LINE_CHANNEL_ACCESS_TOKEN']
HEADER = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + CHANNEL_ACCESS_TOKEN
}

def reply_text(reply_token, text):
    reply = text
    payload = {
        'replyToken': reply_token,
        'message': [
            {
                'type': 'text',
                'text': reply,
            },
        ]
    }

    requests.post(REPLY_ENDPOINT, headers=HEADER, data=json.dumps(payload))
    return reply

def callback(request):
    reply = ''
    print('requiest: ', request)
    request_json = json.loads(request.body.decode('utf-8'))
    for e in request_json['events']:
        reply_token = e['replyToken']
        message_type = e['message']['type']

        if message_type == 'text':
            text = e['message']['text']
            reply += reply_text(reply_token, text)

    return HttpResponse(reply)


@@ -568,24 +568,33 @@
 %5D%0A    %7D%0A%0A   
+ result =
  requests.po
@@ -654,16 +654,46 @@
 yload))%0A
+    print('result: ', result)%0A
     retu
@@ -744,41 +744,8 @@
  ''%0A
-    print('requiest: ', request)%0A
     
@@ -837,16 +837,16 @@
 ents'%5D:%0A
-
         
@@ -875,16 +875,59 @@
 Token'%5D%0A
+        print('replyToken: ', reply_token)%0A
         

Debug commit