2013-06-20 40 views
2

我想使用PostMonkey &烧瓶到HTTP获取电子邮件地址(从我的网站上的一个from)然后订阅它到指定的列表。Python烧瓶Mailchimp注册

它的工作原理,并发送请求用户确认订阅的电子邮件,但无论是服务器错误500的或者调试模式是它与

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

这里说到了我的代码:

@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 

我不确定是什么原因造成的,它一直在困扰着我!

+0

什么是“返回注册”行? – codegeek

+0

它只是在那里,直到我有它显示一个感谢页面,目前不完全需要 –

+0

Flask视图必须返回'Response'对象或元组''(response,status_code,headers)''。 – tbicr

回答

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') 

感谢所有那些评论回