Twilio StudioFlow ngrok 404

2024-06-01 08:20:23 发布

您现在位置:Python中文网/ 问答频道 /正文

嘿,伙计们,我对ngrok和Twilio StudioFlow有一个非常奇怪的问题

出于某种原因,ngrok设置使用(在命令行中键入“ngrok http 5000”),然后将链接复制并粘贴到StudioFlow http小部件中,在之前正常工作时停止工作。现在,当在流程中访问这些小部件时,我得到以下信息:

127.0.0.1 - - [11/Feb/2021 02:18:10] "POST /reminders HTTP/1.1" 404 -
127.0.0.1 - - [11/Feb/2021 02:18:10] "POST /week2 HTTP/1.1" 404 -

烧瓶路由是正确的(/reminders and /week2),我正在小部件(http://8b5dba64ef0c.ngrok.io/reminders)中像这样粘贴它们,所以我真的不知道为什么会突然发生这种情况。为什么twilio找不到我的ngrok隧道

在上下文中,我尝试在不同的端口上运行flask应用程序,但这也不能解决问题。这让我相信如何链接到twilio或我的应用程序中是有问题的。不过我还没找到。我的代码示例如下:

@app.route('/reminders', methods = ['POST', 'GET'])
def remmy():
    # Start our empty response
    resp = MessagingResponse()
    if request.method == 'POST':
        number = request.form['To']
        print(type(number))
        part = Part.query.filter_by(phone_num=number).first()

    def base_reminder(num):

        rem = '[#####]: Don\'t forget to complete your baseline survey to receive an incentive of $35.'
        message = client.messages.create(from_='+1###########',
                                         to=num,
                                         body=rem)
        resp = MessagingResponse()
        msg = resp.message
        return str(resp)

    if not part.baseline:
        base_reminder(part.phone_num)

    return str(resp)

Tags: tohttpnumber链接粘贴部件postresp