Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -206,8 +206,55 @@ def shop_order_new():
|
|
| 206 |
|
| 207 |
|
| 208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
|
| 210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
|
| 212 |
|
| 213 |
|
|
|
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
+
@app.route('/data_gc_tab', methods=['GET'])
|
| 210 |
+
def data_gc_tab():
|
| 211 |
+
api_sys_control = request.args.get('api_sys')
|
| 212 |
+
if api_sys_control != api_key_sys:
|
| 213 |
+
return "EUR 22", 200
|
| 214 |
+
return render_template('data_gc_tab.html')
|
| 215 |
|
| 216 |
|
| 217 |
+
@app.route('/data_gc_tab_out', methods=['GET'])
|
| 218 |
+
def data_gc_tab_out():
|
| 219 |
+
try:
|
| 220 |
+
api_sys_control = request.args.get('api_sys')
|
| 221 |
+
|
| 222 |
+
if api_sys_control != api_key_sys:
|
| 223 |
+
return "EUR 22", 200
|
| 224 |
+
|
| 225 |
+
conn = sqlite3.connect('data_gc.db')
|
| 226 |
+
cursor = conn.cursor()
|
| 227 |
+
cursor.execute('''
|
| 228 |
+
SELECT id, name, phone, email, vk_id, chat_id, ws_st, ws_stop, web_st, fin_prog,
|
| 229 |
+
b_city, b_fin, b_ban, b_ign, b_baners, b_butt, b_mess, shop_st, curator,
|
| 230 |
+
pr1, pr2, pr3, pr4, pr5, gc_url, key_pr, n_con, canal, data_on, data_t, utm_source, utm_medium, utm_campaign, utm_term, utm_content, gcpc
|
| 231 |
+
FROM contacts
|
| 232 |
+
''')
|
| 233 |
+
contacts = cursor.fetchall()
|
| 234 |
+
conn.close()
|
| 235 |
+
|
| 236 |
+
contacts_json = [{
|
| 237 |
+
'id': contact[0], 'name': contact[1], 'phone': contact[2], 'email': contact[3],
|
| 238 |
+
'vk_id': contact[4], 'chat_id': contact[5], 'ws_st': contact[6], 'ws_stop': contact[7],
|
| 239 |
+
'web_st': contact[8], 'fin_prog': contact[9], 'b_city': contact[10], 'b_fin': contact[11],
|
| 240 |
+
'b_ban': contact[12], 'b_ign': contact[13], 'b_baners': contact[14], 'b_butt': contact[15],
|
| 241 |
+
'b_mess': contact[16], 'shop_st': contact[17], 'curator': contact[18], 'pr1': contact[19],
|
| 242 |
+
'pr2': contact[20], 'pr3': contact[21], 'pr4': contact[22], 'pr5': contact[23],
|
| 243 |
+
'gc_url': contact[24], 'key_pr': contact[25], 'n_con': contact[26], 'canal': contact[27],'data_on': contact[28],
|
| 244 |
+
'data_t': contact[29],'utm_source': contact[30], 'utm_medium': contact[31], 'utm_campaign': contact[32],
|
| 245 |
+
'utm_term': contact[33], 'utm_content': contact[34], 'gcpc': contact[34]
|
| 246 |
+
} for contact in contacts]
|
| 247 |
+
return jsonify(contacts_json), 200
|
| 248 |
+
except Exception as e:
|
| 249 |
+
error_message = f"Error getting data from data_gc: {e}"
|
| 250 |
+
print(error_message)
|
| 251 |
+
return error_message, 500
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
|
| 258 |
|
| 259 |
|
| 260 |
|