DmitrMakeev
commited on
Commit
•
161e271
1
Parent(s):
8f91961
Update app.py
Browse files
app.py
CHANGED
@@ -1627,6 +1627,9 @@ def gc_forms():
|
|
1627 |
|
1628 |
|
1629 |
|
|
|
|
|
|
|
1630 |
def verify_phone_number(phone_number):
|
1631 |
verifikation_start = "1"
|
1632 |
print(f"verifikation_start: {verifikation_start}")
|
@@ -1652,12 +1655,24 @@ def verify_phone_number(phone_number):
|
|
1652 |
# Отправляем POST-запрос
|
1653 |
response = requests.post(full_url_ver, headers=headers, data=payload)
|
1654 |
|
1655 |
-
# Печатаем
|
1656 |
print(f"Response Status Code: {response.status_code}")
|
1657 |
-
print(f"Response Body: {response.text}")
|
1658 |
|
1659 |
-
#
|
1660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1661 |
else:
|
1662 |
print("Verification not started")
|
1663 |
return "Verification not started"
|
|
|
1627 |
|
1628 |
|
1629 |
|
1630 |
+
import requests
|
1631 |
+
import json
|
1632 |
+
|
1633 |
def verify_phone_number(phone_number):
|
1634 |
verifikation_start = "1"
|
1635 |
print(f"verifikation_start: {verifikation_start}")
|
|
|
1655 |
# Отправляем POST-запрос
|
1656 |
response = requests.post(full_url_ver, headers=headers, data=payload)
|
1657 |
|
1658 |
+
# Печатаем статус ответа
|
1659 |
print(f"Response Status Code: {response.status_code}")
|
|
|
1660 |
|
1661 |
+
# Проверяем статус код ответа
|
1662 |
+
if response.status_code == 200:
|
1663 |
+
# Печатаем текст ответа от сервера
|
1664 |
+
response_body = response.json()
|
1665 |
+
print(f"Response Body: {response_body}")
|
1666 |
+
|
1667 |
+
# Извлекаем значение из JSON
|
1668 |
+
exists_whatsapp = response_body.get('existsWhatsapp', 'Not Found')
|
1669 |
+
print(f"existsWhatsapp: {exists_whatsapp}")
|
1670 |
+
|
1671 |
+
# Возвращаем значение
|
1672 |
+
return exists_whatsapp
|
1673 |
+
else:
|
1674 |
+
print("Error: Unable to fetch data")
|
1675 |
+
return "Error"
|
1676 |
else:
|
1677 |
print("Verification not started")
|
1678 |
return "Verification not started"
|