Update app.py
Browse files
app.py
CHANGED
|
@@ -233,6 +233,10 @@ def add_contact():
|
|
| 233 |
if not name or not phone or not email:
|
| 234 |
return "Parameters 'name', 'phone', and 'email' are required.", 400
|
| 235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
conn = sqlite3.connect('data1.db')
|
| 237 |
cursor = conn.cursor()
|
| 238 |
cursor.execute('SELECT * FROM contacts WHERE phone = ? OR email = ?', (phone, email))
|
|
|
|
| 233 |
if not name or not phone or not email:
|
| 234 |
return "Parameters 'name', 'phone', and 'email' are required.", 400
|
| 235 |
|
| 236 |
+
# Очистка номера телефона от плюса, если он есть
|
| 237 |
+
if phone.startswith('+'):
|
| 238 |
+
phone = phone[1:]
|
| 239 |
+
|
| 240 |
conn = sqlite3.connect('data1.db')
|
| 241 |
cursor = conn.cursor()
|
| 242 |
cursor.execute('SELECT * FROM contacts WHERE phone = ? OR email = ?', (phone, email))
|