DmitrMakeev commited on
Commit
8e47aa9
1 Parent(s): bcd8cb9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -14
app.py CHANGED
@@ -1628,28 +1628,35 @@ def gc_forms():
1628
 
1629
 
1630
  def verify_phone_number(phone_number):
1631
- full_url_ver = f"{wa_url}{wa_ak}{ws_url_ver}{wa_api_key}"
1632
 
1633
- payload = json.dumps({
1634
- "phoneNumber": phone_number
1635
- })
1636
- headers = {
1637
- 'Content-Type': 'application/json'
1638
- }
 
 
 
1639
 
1640
- response = requests.post(full_url_ver, headers=headers, data=payload)
1641
 
1642
- # Печать тела ответа на консоль
1643
- print("Response Status Code:", response.status_code)
1644
- print("Response Body:", response.text)
1645
 
1646
- if response.status_code == 200:
1647
- result = response.json()
1648
- return result.get('existsWhatsapp', False)
 
 
 
 
1649
  else:
1650
  return False
1651
 
1652
 
 
1653
  # Функция для добавления или обновления контакта в базе данных
1654
  def add_or_update_contact(contact_data):
1655
  conn = sqlite3.connect(DATABASE_NAME)
 
1628
 
1629
 
1630
  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
+ })
1639
+ headers = {
1640
+ 'Content-Type': 'application/json'
1641
+ }
1642
 
1643
+ response = requests.post(full_url_ver, headers=headers, data=payload)
1644
 
1645
+ print("Response Status Code:", response.status_code)
1646
+ print("Response Body:", response.text)
 
1647
 
1648
+ if response.status_code == 200:
1649
+ result = response.json()
1650
+ exists_whatsapp = result.get('existsWhatsapp', False)
1651
+ print("existsWhatsapp:", exists_whatsapp) # Вывод значения переменной
1652
+ return exists_whatsapp
1653
+ else:
1654
+ return False
1655
  else:
1656
  return False
1657
 
1658
 
1659
+
1660
  # Функция для добавления или обновления контакта в базе данных
1661
  def add_or_update_contact(contact_data):
1662
  conn = sqlite3.connect(DATABASE_NAME)