DmitrMakeev
commited on
Commit
•
9bd6258
1
Parent(s):
6d6d24d
Update app.py
Browse files
app.py
CHANGED
@@ -1628,6 +1628,15 @@ def gc_forms():
|
|
1628 |
|
1629 |
DATABASE_NAME3 = 'data_gc.db'
|
1630 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1631 |
def verify_phone_number(phone_number):
|
1632 |
verifikation_start = "1"
|
1633 |
print(f"verifikation_start: {verifikation_start}")
|
@@ -1675,6 +1684,8 @@ def verify_phone_number(phone_number):
|
|
1675 |
print("Verification not started")
|
1676 |
return "Verification not started"
|
1677 |
|
|
|
|
|
1678 |
# Функция для добавления или обновления контакта в базе данных
|
1679 |
def add_or_update_contact(contact_data):
|
1680 |
conn = sqlite3.connect(DATABASE_NAME3)
|
@@ -1689,7 +1700,7 @@ def add_or_update_contact(contact_data):
|
|
1689 |
contact = cursor.fetchone()
|
1690 |
|
1691 |
# List all fields for updating or inserting
|
1692 |
-
fields =
|
1693 |
|
1694 |
placeholders = ", ".join([f"{field} = ?" for field in fields])
|
1695 |
|
@@ -1709,7 +1720,8 @@ def add_data_ver():
|
|
1709 |
contact_data = {
|
1710 |
'name': request.args.get('name', ''),
|
1711 |
'phone': request.args.get('phone', ''),
|
1712 |
-
'email': request.args.get('email', '')
|
|
|
1713 |
}
|
1714 |
|
1715 |
# Получение значения проверки номера телефона
|
@@ -1724,6 +1736,9 @@ def add_data_ver():
|
|
1724 |
logging.error(f"Error adding/updating contact: {e}")
|
1725 |
return jsonify({'status': 'error', 'message': str(e)}), 500
|
1726 |
|
|
|
|
|
|
|
1727 |
|
1728 |
|
1729 |
initialize_requests()
|
|
|
1628 |
|
1629 |
DATABASE_NAME3 = 'data_gc.db'
|
1630 |
|
1631 |
+
import sqlite3
|
1632 |
+
import json
|
1633 |
+
import requests
|
1634 |
+
from flask import Flask, request, jsonify
|
1635 |
+
import logging
|
1636 |
+
|
1637 |
+
DATABASE_NAME3 = 'data_gc.db'
|
1638 |
+
app = Flask(__name__)
|
1639 |
+
|
1640 |
def verify_phone_number(phone_number):
|
1641 |
verifikation_start = "1"
|
1642 |
print(f"verifikation_start: {verifikation_start}")
|
|
|
1684 |
print("Verification not started")
|
1685 |
return "Verification not started"
|
1686 |
|
1687 |
+
REQUIRED_FIELDS = ["name", "phone", "email", "ws_st"]
|
1688 |
+
|
1689 |
# Функция для добавления или обновления контакта в базе данных
|
1690 |
def add_or_update_contact(contact_data):
|
1691 |
conn = sqlite3.connect(DATABASE_NAME3)
|
|
|
1700 |
contact = cursor.fetchone()
|
1701 |
|
1702 |
# List all fields for updating or inserting
|
1703 |
+
fields = [field for field in REQUIRED_FIELDS if field in contact_data]
|
1704 |
|
1705 |
placeholders = ", ".join([f"{field} = ?" for field in fields])
|
1706 |
|
|
|
1720 |
contact_data = {
|
1721 |
'name': request.args.get('name', ''),
|
1722 |
'phone': request.args.get('phone', ''),
|
1723 |
+
'email': request.args.get('email', ''),
|
1724 |
+
'ws_st': request.args.get('ws_st', '')
|
1725 |
}
|
1726 |
|
1727 |
# Получение значения проверки номера телефона
|
|
|
1736 |
logging.error(f"Error adding/updating contact: {e}")
|
1737 |
return jsonify({'status': 'error', 'message': str(e)}), 500
|
1738 |
|
1739 |
+
if __name__ == '__main__':
|
1740 |
+
app.run(debug=True)
|
1741 |
+
|
1742 |
|
1743 |
|
1744 |
initialize_requests()
|