@@ -41,20 +41,20 @@ def index():
4141 access_token = access_token [0 ]
4242 global customer_list
4343 customer_list = excel .load_excel ()
44- return render_template ('index.html' ,
44+ return render_template ('index.html' ,
4545 customer_dict = customer_list ,
4646 title = "QB Customer Leads" ,
4747 text_color = font_color )
4848
4949# Update leads in html after adding a customer to QBO handled here for simplicity
50- @app .route ('/' , methods = ['GET' , ' POST' ])
50+ @app .route ('/' , methods = ['POST' ])
5151def update_table ():
5252 customer_id = request .form ['id' ]
5353 for customer in customer_list :
5454 if customer ['Id' ] == customer_id :
5555 # Create customer object, add customer to qbo and get response
5656 customer_obj = create_customer (customer )
57- response_data = add_customer (customer_obj , req_context )
57+ response_data = add_customer (customer_obj , request_context )
5858 status_code = response_data ['status_code' ]
5959 message = response_data ['message' ]
6060 global font_color
@@ -72,7 +72,7 @@ def update_table():
7272
7373@app .route ('/auth' )
7474def auth ():
75- return qbo .authorize (callback = url_for ('oauth_authorized' ))
75+ return qbo .authorize (callback = url_for ('oauth_authorized' ))
7676
7777@app .route ('/reset-session' )
7878def reset_session ():
@@ -91,13 +91,15 @@ def oauth_authorized(resp):
9191 return redirect (next_url )
9292 # Setting the session using flask session just for the simplicity of this Sample App. It's not the most secure way to do this.
9393 session ['is_authorized' ] = True
94+ access_token = resp ['oauth_token' ]
95+ session ['access_token' ] = access_token
9496 session ['realm_id' ] = realm_id
9597 session ['qbo_token' ] = (
9698 resp ['oauth_token' ],
9799 resp ['oauth_token_secret' ]
98100 )
99- global req_context
100- req_context = req_context ()
101+ global request_context
102+ request_context = req_context ()
101103 return redirect (url_for ('index' ))
102104
103105if __name__ == '__main__' :
0 commit comments