DmitrMakeev commited on
Commit
1d8ea83
·
verified ·
1 Parent(s): 2dee44b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -373
app.py CHANGED
@@ -182,388 +182,31 @@ def handle_incoming_request():
182
  elif current_day == 2: # Среда
183
  if current_hour < 19:
184
  # Утром в среду
185
- # Комментарий: Отправка в лист 1, лист 2, лист 3
186
- show_params = False
187
- list_id = 560774
188
- name = request.args.get('name')
189
- email = request.args.get('email')
190
- phone = request.args.get('phone')
191
- data = {
192
- "email": email,
193
- "unconfirmed": False,
194
- "values": [
195
- {
196
- "parameter_id": 393120,
197
- "kind": "string",
198
- "list_id": 560774,
199
- "title": "phone",
200
- "value": phone
201
- },
202
- {
203
- "parameter_id": 393119,
204
- "kind": "string",
205
- "list_id": 560774,
206
- "title": "name",
207
- "value": name
208
- }
209
- ]
210
- }
211
- headers = {
212
- 'Authorization': f'Bearer {token}',
213
- 'Content-Type': 'application/json'
214
- }
215
- response = requests.post(f"{base_url}/email/lists/560774/recipients", json=data, headers=headers)
216
-
217
- show_params = False
218
- list_id = 560775
219
- name = request.args.get('name')
220
- email = request.args.get('email')
221
- phone = request.args.get('phone')
222
- data = {
223
- "email": email,
224
- "unconfirmed": False,
225
- "values": [
226
- {
227
- "parameter_id": 393120,
228
- "kind": "string",
229
- "list_id": 560775,
230
- "title": "phone",
231
- "value": phone
232
- },
233
- {
234
- "parameter_id": 393119,
235
- "kind": "string",
236
- "list_id": 560775,
237
- "title": "name",
238
- "value": name
239
- }
240
- ]
241
- }
242
- headers = {
243
- 'Authorization': f'Bearer {token}',
244
- 'Content-Type': 'application/json'
245
- }
246
- response = requests.post(f"{base_url}/email/lists/560775/recipients", json=data, headers=headers)
247
-
248
- show_params = False
249
- list_id = 560776
250
- name = request.args.get('name')
251
- email = request.args.get('email')
252
- phone = request.args.get('phone')
253
- data = {
254
- "email": email,
255
- "unconfirmed": False,
256
- "values": [
257
- {
258
- "parameter_id": 393120,
259
- "kind": "string",
260
- "list_id": 560776,
261
- "title": "phone",
262
- "value": phone
263
- },
264
- {
265
- "parameter_id": 393119,
266
- "kind": "string",
267
- "list_id": 560776,
268
- "title": "name",
269
- "value": name
270
- }
271
- ]
272
- }
273
- headers = {
274
- 'Authorization': f'Bearer {token}',
275
- 'Content-Type': 'application/json'
276
- }
277
- response = requests.post(f"{base_url}/email/lists/560776/recipients", json=data, headers=headers)
278
-
279
  else:
280
  # Вечером в среду
281
- # Комментарий: Отправка в лист 1, лист 2, лист 3
282
- show_params = False
283
- list_id = 560777
284
- name = request.args.get('name')
285
- email = request.args.get('email')
286
- phone = request.args.get('phone')
287
- data = {
288
- "email": email,
289
- "unconfirmed": False,
290
- "values": [
291
- {
292
- "parameter_id": 393120,
293
- "kind": "string",
294
- "list_id": 560777,
295
- "title": "phone",
296
- "value": phone
297
- },
298
- {
299
- "parameter_id": 393119,
300
- "kind": "string",
301
- "list_id": 560777,
302
- "title": "name",
303
- "value": name
304
- }
305
- ]
306
- }
307
- headers = {
308
- 'Authorization': f'Bearer {token}',
309
- 'Content-Type': 'application/json'
310
- }
311
- response = requests.post(f"{base_url}/email/lists/560777/recipients", json=data, headers=headers)
312
-
313
- show_params = False
314
- list_id = 560778
315
- name = request.args.get('name')
316
- email = request.args.get('email')
317
- phone = request.args.get('phone')
318
- data = {
319
- "email": email,
320
- "unconfirmed": False,
321
- "values": [
322
- {
323
- "parameter_id": 393120,
324
- "kind": "string",
325
- "list_id": 560778,
326
- "title": "phone",
327
- "value": phone
328
- },
329
- {
330
- "parameter_id": 393119,
331
- "kind": "string",
332
- "list_id": 560778,
333
- "title": "name",
334
- "value": name
335
- }
336
- ]
337
- }
338
- headers = {
339
- 'Authorization': f'Bearer {token}',
340
- 'Content-Type': 'application/json'
341
- }
342
- response = requests.post(f"{base_url}/email/lists/560778/recipients", json=data, headers=headers)
343
-
344
- show_params = False
345
- list_id = 560779
346
- name = request.args.get('name')
347
- email = request.args.get('email')
348
- phone = request.args.get('phone')
349
- data = {
350
- "email": email,
351
- "unconfirmed": False,
352
- "values": [
353
- {
354
- "parameter_id": 393120,
355
- "kind": "string",
356
- "list_id": 560779,
357
- "title": "phone",
358
- "value": phone
359
- },
360
- {
361
- "parameter_id": 393119,
362
- "kind": "string",
363
- "list_id": 560779,
364
- "title": "name",
365
- "value": name
366
- }
367
- ]
368
- }
369
- headers = {
370
- 'Authorization': f'Bearer {token}',
371
- 'Content-Type': 'application/json'
372
- }
373
- response = requests.post(f"{base_url}/email/lists/560779/recipients", json=data, headers=headers)
374
 
375
  elif current_day == 3: # Четверг
376
  if current_hour < 19:
377
- # Утром в четверг
378
- # Комментарий: Отправка в лист 1, лист 2, лист 3
379
- show_params = False
380
- list_id = 560780
381
- name = request.args.get('name')
382
- email = request.args.get('email')
383
- phone = request.args.get('phone')
384
- data = {
385
- "email": email,
386
- "unconfirmed": False,
387
- "values": [
388
- {
389
- "parameter_id": 393120,
390
- "kind": "string",
391
- "list_id": 560780,
392
- "title": "phone",
393
- "value": phone
394
- },
395
- {
396
- "parameter_id": 393119,
397
- "kind": "string",
398
- "list_id": 560780,
399
- "title": "name",
400
- "value": name
401
- }
402
- ]
403
- }
404
- headers = {
405
- 'Authorization': f'Bearer {token}',
406
- 'Content-Type': 'application/json'
407
- }
408
- response = requests.post(f"{base_url}/email/lists/560780/recipients", json=data, headers=headers)
409
-
410
- show_params = False
411
- list_id = 560781
412
- name = request.args.get('name')
413
- email = request.args.get('email')
414
- phone = request.args.get('phone')
415
- data = {
416
- "email": email,
417
- "unconfirmed": False,
418
- "values": [
419
- {
420
- "parameter_id": 393120,
421
- "kind": "string",
422
- "list_id": 560781,
423
- "title": "phone",
424
- "value": phone
425
- },
426
- {
427
- "parameter_id": 393119,
428
- "kind": "string",
429
- "list_id": 560781,
430
- "title": "name",
431
- "value": name
432
- }
433
- ]
434
- }
435
- headers = {
436
- 'Authorization': f'Bearer {token}',
437
- 'Content-Type': 'application/json'
438
- }
439
- response = requests.post(f"{base_url}/email/lists/560781/recipients", json=data, headers=headers)
440
-
441
- show_params = False
442
- list_id = 560782
443
- name = request.args.get('name')
444
- email = request.args.get('email')
445
- phone = request.args.get('phone')
446
- data = {
447
- "email": email,
448
- "unconfirmed": False,
449
- "values": [
450
- {
451
- "parameter_id": 393120,
452
- "kind": "string",
453
- "list_id": 560782,
454
- "title": "phone",
455
- "value": phone
456
- },
457
- {
458
- "parameter_id": 393119,
459
- "kind": "string",
460
- "list_id": 560782,
461
- "title": "name",
462
- "value": name
463
- }
464
- ]
465
- }
466
- headers = {
467
- 'Authorization': f'Bearer {token}',
468
- 'Content-Type': 'application/json'
469
- }
470
- response = requests.post(f"{base_url}/email/lists/560782/recipients", json=data, headers=headers)
471
 
472
  else:
473
  # Вечером в четверг
474
  # Комментарий: Отправка в лист 1, лист 2, лист 3
475
- show_params = False
476
- list_id = 560783
477
- name = request.args.get('name')
478
- email = request.args.get('email')
479
- phone = request.args.get('phone')
480
- data = {
481
- "email": email,
482
- "unconfirmed": False,
483
- "values": [
484
- {
485
- "parameter_id": 393120,
486
- "kind": "string",
487
- "list_id": 560783,
488
- "title": "phone",
489
- "value": phone
490
- },
491
- {
492
- "parameter_id": 393119,
493
- "kind": "string",
494
- "list_id": 560783,
495
- "title": "name",
496
- "value": name
497
- }
498
- ]
499
- }
500
- headers = {
501
- 'Authorization': f'Bearer {token}',
502
- 'Content-Type': 'application/json'
503
- }
504
- response = requests.post(f"{base_url}/email/lists/560783/recipients", json=data, headers=headers)
505
-
506
- show_params = False
507
- list_id = 560784
508
- name = request.args.get('name')
509
- email = request.args.get('email')
510
- phone = request.args.get('phone')
511
- data = {
512
- "email": email,
513
- "unconfirmed": False,
514
- "values": [
515
- {
516
- "parameter_id": 393120,
517
- "kind": "string",
518
- "list_id": 560784,
519
- "title": "phone",
520
- "value": phone
521
- },
522
- {
523
- "parameter_id": 393119,
524
- "kind": "string",
525
- "list_id": 560784,
526
- "title": "name",
527
- "value": name
528
- }
529
- ]
530
- }
531
- headers = {
532
- 'Authorization': f'Bearer {token}',
533
- 'Content-Type': 'application/json'
534
- }
535
- response = requests.post(f"{base_url}/email/lists/560784/recipients", json=data, headers=headers)
536
-
537
- show_params = False
538
- list_id = 560785
539
- name = request.args.get('name')
540
- email = request.args.get('email')
541
- phone = request.args.get('phone')
542
- data = {
543
- "email": email,
544
- "unconfirmed": False,
545
- "values": [
546
- {
547
- "parameter_id": 393120,
548
- "kind": "string",
549
- "list_id": 560785,
550
- "title": "phone",
551
- "value": phone
552
- },
553
- {
554
- "parameter_id": 393119,
555
- "kind": "string",
556
- "list_id": 560785,
557
- "title": "name",
558
- "value": name
559
- }
560
- ]
561
- }
562
- headers = {
563
- 'Authorization': f'Bearer {token}',
564
- 'Content-Type': 'application/json'
565
- }
566
- response = requests.post(f"{base_url}/email/lists/560785/recipients", json=data, headers=headers)
567
 
568
  return response.json()
569
 
 
182
  elif current_day == 2: # Среда
183
  if current_hour < 19:
184
  # Утром в среду
185
+ response_2 = send_request(560832, email, phone, name, 393196, 393195, pr5, pr4, pr3, pr2, pr1, 393267, 393266, 393265, 393264, 393263)
186
+ response_3 = send_request(560833, email, phone, name, 393198, 393197, pr5, pr4, pr3, pr2, pr1, 393272, 393271, 393270, 393269, 393268)
187
+ # Возвращаем список ответов
188
+ return {'responses': [response_2,response_3]}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  else:
190
  # Вечером в среду
191
+ response_3 = send_request(560833, email, phone, name, 393198, 393197, pr5, pr4, pr3, pr2, pr1, 393272, 393271, 393270, 393269, 393268)
192
+ # Возвращаем список ответов
193
+ return {'responses': [response_3]}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
 
195
  elif current_day == 3: # Четверг
196
  if current_hour < 19:
197
+ response_3 = send_request(560833, email, phone, name, 393198, 393197, pr5, pr4, pr3, pr2, pr1, 393272, 393271, 393270, 393269, 393268)
198
+ # Возвращаем список ответов
199
+ return {'responses': [response_3]}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
 
201
  else:
202
  # Вечером в четверг
203
  # Комментарий: Отправка в лист 1, лист 2, лист 3
204
+ # Отправляем запросы в листы подряд
205
+ response_1 = send_request(560768, email, phone, name, 393120, 393119, pr5, pr4, pr3, pr2, pr1, 393248, 393247, 393246, 393245, 393244)
206
+ response_2 = send_request(560832, email, phone, name, 393196, 393195, pr5, pr4, pr3, pr2, pr1, 393267, 393266, 393265, 393264, 393263)
207
+ response_3 = send_request(560833, email, phone, name, 393198, 393197, pr5, pr4, pr3, pr2, pr1, 393272, 393271, 393270, 393269, 393268)
208
+ # Возвращаем список ответов
209
+ return {'responses': [response_1,response_2,response_3]}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
 
211
  return response.json()
212