2

I'm trying to use PostMonkey & Flask to HTTP GET an email address (from a from on my website) and then subscribe this to the specified list.

It works and sends the email requesting the user to confirm the subscription, but either server error 500's or when debug mode is on it comes up with

TypeError: signup() takes no arguments (2 given)

Here's my code:

@app.route("/signup", methods=['GET'])
def signup():

    try:
        email = request.args.get('email')
        pm.listSubscribe(id="cdc2ba625c", email_address=email)

    except MailChimpException, e:

        print e.code
        print e.error
        return redirect("/")

return signup

I'm not sure what's causing it and it's been bugging me for a while!

4

1 回答 1

1

如果有人感兴趣,这个问题与我的“返回”声明有关,结果是烧瓶不喜欢什么都不返回。

@app.route('/signup', methods=['POST'])
def signup():

    try:
        email = request.form['email']
        #email = request.args.get('email')
        pm.listSubscribe(id="cdc2ba625c", email_address=email, double_optin=False)

    except MailChimpException, e:

        print e.code
        print e.error
        return redirect("/")

    return render_template('index.html')

感谢所有评论的人

于 2013-06-21T15:43:28.323 回答