DmitrMakeev commited on
Commit
e1af0d4
·
verified ·
1 Parent(s): eb5fa02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -73
app.py CHANGED
@@ -14,7 +14,9 @@ name = '0'
14
  email = '0'
15
  phone = '0'
16
 
17
-
 
 
18
 
19
  app = Flask(__name__, template_folder="./")
20
 
@@ -154,9 +156,7 @@ def handle_incoming_request():
154
 
155
  if current_day in [0, 4, 5, 6]: # Понедельник, Пятница, Суббота, Воскресенье
156
  # Отправка в лист 1, лист 2 подряд
157
- list_id_1 = 560768
158
- list_id_2 = 560832
159
- list_id_3 = 560833
160
  # Лист 1
161
  data_1 = {
162
  "email": email,
@@ -256,88 +256,27 @@ def handle_incoming_request():
256
  if current_hour < 19:
257
  # Утром во вторник
258
  # Комментарий: Отправка в лист 1, лист 2, лист 3
259
- show_params = False
260
- list_id = 560768
261
- name = request.args.get('name')
262
- email = request.args.get('email')
263
- phone = request.args.get('phone')
264
- data = {
265
- "email": email,
266
- "unconfirmed": False,
267
- "values": [
268
- {
269
- "parameter_id": 393198,
270
- "kind": "string",
271
- "list_id": 560833,
272
- "title": "phone",
273
- "value": phone
274
- },
275
- {
276
- "parameter_id": 393197,
277
- "kind": "string",
278
- "list_id": 560833,
279
- "title": "name",
280
- "value": name
281
- }
282
- ]
283
- }
284
- headers = {
285
- 'Authorization': f'Bearer {token}',
286
- 'Content-Type': 'application/json'
287
- }
288
- response = requests.post(f"{base_url}/email/lists/560768/recipients", json=data, headers=headers)
289
 
290
- show_params = False
291
- list_id = 560769
292
- name = request.args.get('name')
293
- email = request.args.get('email')
294
- phone = request.args.get('phone')
295
- data = {
296
- "email": email,
297
- "unconfirmed": False,
298
- "values": [
299
- {
300
- "parameter_id": 393120,
301
- "kind": "string",
302
- "list_id": 560769,
303
- "title": "phone",
304
- "value": phone
305
- },
306
- {
307
- "parameter_id": 393119,
308
- "kind": "string",
309
- "list_id": 560769,
310
- "title": "name",
311
- "value": name
312
- }
313
- ]
314
- }
315
- headers = {
316
- 'Authorization': f'Bearer {token}',
317
- 'Content-Type': 'application/json'
318
- }
319
- response = requests.post(f"{base_url}/email/lists/560769/recipients", json=data, headers=headers)
320
 
321
- show_params = False
322
- list_id = 560770
323
- name = request.args.get('name')
324
- email = request.args.get('email')
325
- phone = request.args.get('phone')
326
- data = {
327
  "email": email,
328
  "unconfirmed": False,
329
  "values": [
330
  {
331
  "parameter_id": 393120,
332
  "kind": "string",
333
- "list_id": 560770,
334
  "title": "phone",
335
  "value": phone
336
  },
337
  {
338
  "parameter_id": 393119,
339
  "kind": "string",
340
- "list_id": 560770,
341
  "title": "name",
342
  "value": name
343
  }
@@ -347,7 +286,19 @@ def handle_incoming_request():
347
  'Authorization': f'Bearer {token}',
348
  'Content-Type': 'application/json'
349
  }
350
- response = requests.post(f"{base_url}/email/lists/560770/recipients", json=data, headers=headers)
 
 
 
 
 
 
 
 
 
 
 
 
351
 
352
  else:
353
  # Вечером во вторник
 
14
  email = '0'
15
  phone = '0'
16
 
17
+ list_id_1 = 560768
18
+ list_id_2 = 560832
19
+ list_id_3 = 560833
20
 
21
  app = Flask(__name__, template_folder="./")
22
 
 
156
 
157
  if current_day in [0, 4, 5, 6]: # Понедельник, Пятница, Суббота, Воскресенье
158
  # Отправка в лист 1, лист 2 подряд
159
+
 
 
160
  # Лист 1
161
  data_1 = {
162
  "email": email,
 
256
  if current_hour < 19:
257
  # Утром во вторник
258
  # Комментарий: Отправка в лист 1, лист 2, лист 3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
+
262
+
263
+
264
+ # Лист 1
265
+ data_1 = {
 
266
  "email": email,
267
  "unconfirmed": False,
268
  "values": [
269
  {
270
  "parameter_id": 393120,
271
  "kind": "string",
272
+ "list_id": list_id_1,
273
  "title": "phone",
274
  "value": phone
275
  },
276
  {
277
  "parameter_id": 393119,
278
  "kind": "string",
279
+ "list_id": list_id_1,
280
  "title": "name",
281
  "value": name
282
  }
 
286
  'Authorization': f'Bearer {token}',
287
  'Content-Type': 'application/json'
288
  }
289
+
290
+ # Отправляем первый запрос и сохраняем ответ
291
+ response_1 = requests.post(f"{base_url}/email/lists/{list_id_1}/recipients", json=data_1, headers=headers)
292
+
293
+
294
+
295
+
296
+
297
+
298
+ # Возвращаем список ответов
299
+ return {'responses': [response_1.json()]}
300
+
301
+
302
 
303
  else:
304
  # Вечером во вторник