DmitrMakeev
commited on
Commit
•
2f1eeaa
1
Parent(s):
ba7ecbd
Update app.py
Browse files
app.py
CHANGED
@@ -234,7 +234,25 @@ def data_gc_tab():
|
|
234 |
|
235 |
|
236 |
|
|
|
|
|
|
|
|
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
|
239 |
|
240 |
|
|
|
234 |
|
235 |
|
236 |
|
237 |
+
@app.route('/data_gc_tab_out', methods=['GET'])
|
238 |
+
def data_gc_tab_out():
|
239 |
+
try:
|
240 |
+
api_sys_control = request.args.get('api_sys')
|
241 |
|
242 |
+
if api_sys_control != api_key_sys:
|
243 |
+
return "EUR 22", 200
|
244 |
+
|
245 |
+
conn = sqlite3.connect('data_gc.db')
|
246 |
+
cursor = conn.cursor()
|
247 |
+
cursor.execute('SELECT name, phone, email FROM contacts')
|
248 |
+
contacts = cursor.fetchall()
|
249 |
+
conn.close()
|
250 |
+
|
251 |
+
contacts_json = [{'name': contact[0], 'phone': contact[1], 'email': contact[2]} for contact in contacts]
|
252 |
+
return jsonify(contacts_json), 200
|
253 |
+
except Exception as e:
|
254 |
+
print(f"Error getting data from data_gc: {e}")
|
255 |
+
return "Internal Server Error", 500
|
256 |
|
257 |
|
258 |
|