Exemplo n.º 1
0
def callback():
    signature = request.headers['X-Line-Signature']
    body = request.get_data(as_text=True)
    app.logger.info("Request body: " + body)

    print(body)
    try:
        handler.handle(body, signature)
    except InvalidSignatureError:
        abort(400)

    return 'OK'
Exemplo n.º 2
0
def callback(secret, token):
    if token not in bots:
        bots[token] = LineBot(push=False, token=token)

    # get X-Line-Signature header value
    signature = request.headers['X-Line-Signature']

    # get request body as text
    body = request.get_data(as_text=True)
    #logger.info("Request body: " + body)

    # handle webhook body
    try:
        getHandle(token, secret).handle(body, signature)
    except InvalidSignatureError:
        abort(400)

    return 'ok'