@@ -41,20 +41,20 @@ def index():
41
41
access_token = access_token [0 ]
42
42
global customer_list
43
43
customer_list = excel .load_excel ()
44
- return render_template ('index.html' ,
44
+ return render_template ('index.html' ,
45
45
customer_dict = customer_list ,
46
46
title = "QB Customer Leads" ,
47
47
text_color = font_color )
48
48
49
49
# 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' ])
51
51
def update_table ():
52
52
customer_id = request .form ['id' ]
53
53
for customer in customer_list :
54
54
if customer ['Id' ] == customer_id :
55
55
# Create customer object, add customer to qbo and get response
56
56
customer_obj = create_customer (customer )
57
- response_data = add_customer (customer_obj , req_context )
57
+ response_data = add_customer (customer_obj , request_context )
58
58
status_code = response_data ['status_code' ]
59
59
message = response_data ['message' ]
60
60
global font_color
@@ -72,7 +72,7 @@ def update_table():
72
72
73
73
@app .route ('/auth' )
74
74
def auth ():
75
- return qbo .authorize (callback = url_for ('oauth_authorized' ))
75
+ return qbo .authorize (callback = url_for ('oauth_authorized' ))
76
76
77
77
@app .route ('/reset-session' )
78
78
def reset_session ():
@@ -91,13 +91,15 @@ def oauth_authorized(resp):
91
91
return redirect (next_url )
92
92
# Setting the session using flask session just for the simplicity of this Sample App. It's not the most secure way to do this.
93
93
session ['is_authorized' ] = True
94
+ access_token = resp ['oauth_token' ]
95
+ session ['access_token' ] = access_token
94
96
session ['realm_id' ] = realm_id
95
97
session ['qbo_token' ] = (
96
98
resp ['oauth_token' ],
97
99
resp ['oauth_token_secret' ]
98
100
)
99
- global req_context
100
- req_context = req_context ()
101
+ global request_context
102
+ request_context = req_context ()
101
103
return redirect (url_for ('index' ))
102
104
103
105
if __name__ == '__main__' :
0 commit comments