2013-06-20 69 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') 

感謝所有那些評論回