mailgun and flask forms -


i keep getting following error when run code:

typeerror: 'response' object not callable

here code...

from flask import flask, render_template, flash import os import requests  import forms  app = flask(__name__) app.secret_key = 'jfdsjajfjds'  mg_key = os.environ['mailgun_api_key']  @app.route("/", methods=('get', 'post')) def landing():     form = forms.optinform()     if form.validate_on_submit():         return requests.post(             "https://api.mailgun.net/v3/lists/test_list@sandbox.mailgun.org/members",             auth=('api', 'mg_key'),             data={'subscribed': true,                   'address': form.email.data,                   'name': form.first_name.data})     flash("thanks! check email.")     return render_template('landing.html', form=form)    if __name__ == "__main__":     app.run() 

i figured out problem. calling api key variable string. fixed changing 'mg_key' mg_key


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -