DmitrMakeev
commited on
Commit
•
741937c
1
Parent(s):
3d13b5c
Update app.py
Browse files
app.py
CHANGED
@@ -1631,8 +1631,10 @@ def verify_phone_number(phone_number):
|
|
1631 |
verifikation_start = os.getenv('verifikation_start')
|
1632 |
|
1633 |
if verifikation_start == "1":
|
|
|
1634 |
full_url_ver = f"{wa_url}{wa_ak}{ws_url_ver}{wa_api_key}"
|
1635 |
|
|
|
1636 |
payload = json.dumps({
|
1637 |
"phoneNumber": phone_number
|
1638 |
})
|
@@ -1640,30 +1642,21 @@ def verify_phone_number(phone_number):
|
|
1640 |
'Content-Type': 'application/json'
|
1641 |
}
|
1642 |
|
|
|
1643 |
print("Request URL:", full_url_ver)
|
1644 |
print("Request Payload:", payload)
|
1645 |
|
|
|
1646 |
response = requests.post(full_url_ver, headers=headers, data=payload)
|
1647 |
|
1648 |
# Выводим статус-код и тело ответа
|
1649 |
print("Response Status Code:", response.status_code)
|
1650 |
print("Response Body:", response.text)
|
1651 |
|
1652 |
-
#
|
1653 |
-
|
1654 |
-
try:
|
1655 |
-
result = response.json()
|
1656 |
-
exists_whatsapp = result.get('existsWhatsapp', False)
|
1657 |
-
print("existsWhatsapp:", exists_whatsapp) # Вывод значения переменной
|
1658 |
-
return exists_whatsapp
|
1659 |
-
except json.JSONDecodeError:
|
1660 |
-
print("Ошибка декодирования JSON")
|
1661 |
-
return False
|
1662 |
-
else:
|
1663 |
-
print("Ошибка ответа сервера:", response.text)
|
1664 |
-
return False
|
1665 |
else:
|
1666 |
-
return
|
1667 |
|
1668 |
|
1669 |
|
|
|
1631 |
verifikation_start = os.getenv('verifikation_start')
|
1632 |
|
1633 |
if verifikation_start == "1":
|
1634 |
+
# Собираем полный URL из переменных окружения
|
1635 |
full_url_ver = f"{wa_url}{wa_ak}{ws_url_ver}{wa_api_key}"
|
1636 |
|
1637 |
+
# Создаем payload для запроса
|
1638 |
payload = json.dumps({
|
1639 |
"phoneNumber": phone_number
|
1640 |
})
|
|
|
1642 |
'Content-Type': 'application/json'
|
1643 |
}
|
1644 |
|
1645 |
+
# Выводим URL и payload для отладки
|
1646 |
print("Request URL:", full_url_ver)
|
1647 |
print("Request Payload:", payload)
|
1648 |
|
1649 |
+
# Отправляем POST-запрос
|
1650 |
response = requests.post(full_url_ver, headers=headers, data=payload)
|
1651 |
|
1652 |
# Выводим статус-код и тело ответа
|
1653 |
print("Response Status Code:", response.status_code)
|
1654 |
print("Response Body:", response.text)
|
1655 |
|
1656 |
+
# Возвращаем полный ответ от сервера
|
1657 |
+
return response.text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1658 |
else:
|
1659 |
+
return "Verification not started"
|
1660 |
|
1661 |
|
1662 |
|