DmitrMakeev commited on
Commit
fb6dceb
·
verified ·
1 Parent(s): aeb58f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -375
app.py CHANGED
@@ -239,17 +239,14 @@ def handle_incoming_request():
239
  elif current_day == 1: # Вторник
240
  if current_hour < 19:
241
  # Утром во вторник
242
- response_1 = send_request(560768, email, phone, name, 393120, 393119, pr5, pr4, pr3, pr2, pr1, 393248, 393247, 393246, 393245, 393244)
243
- response_2 = send_request(560832, email, phone, name, 393196, 393195, pr5, pr4, pr3, pr2, pr1, 393267, 393266, 393265, 393264, 393263)
244
- response_3 = send_request(560833, email, phone, name, 393198, 393197, pr5, pr4, pr3, pr2, pr1, 393272, 393271, 393270, 393269, 393268)
245
  # Возвращаем список ответов
246
  return {'responses': [response_1,response_2,response_3]}
247
  else:
248
  # Вечером во вторник
249
- response_2 = send_request(560832, email, phone, name, 393196, 393195, pr5, pr4, pr3, pr2, pr1, 393267, 393266, 393265, 393264, 393263)
250
- response_3 = send_request(560833, email, phone, name, 393198, 393197, pr5, pr4, pr3, pr2, pr1, 393272, 393271, 393270, 393269, 393268)
251
- # Возвращаем список ответов
252
- return {'responses': [response_2,response_3]}
253
 
254
 
255
 
@@ -275,387 +272,23 @@ def handle_incoming_request():
275
  if current_hour < 19:
276
  # Утром в среду
277
  # Комментарий: Отправка в лист 1, лист 2, лист 3
278
- show_params = False
279
- list_id = 560774
280
- name = request.args.get('name')
281
- email = request.args.get('email')
282
- phone = request.args.get('phone')
283
- data = {
284
- "email": email,
285
- "unconfirmed": False,
286
- "values": [
287
- {
288
- "parameter_id": 393120,
289
- "kind": "string",
290
- "list_id": 560774,
291
- "title": "phone",
292
- "value": phone
293
- },
294
- {
295
- "parameter_id": 393119,
296
- "kind": "string",
297
- "list_id": 560774,
298
- "title": "name",
299
- "value": name
300
- }
301
- ]
302
- }
303
- headers = {
304
- 'Authorization': f'Bearer {token}',
305
- 'Content-Type': 'application/json'
306
- }
307
- response = requests.post(f"{base_url}/email/lists/560774/recipients", json=data, headers=headers)
308
-
309
- show_params = False
310
- list_id = 560775
311
- name = request.args.get('name')
312
- email = request.args.get('email')
313
- phone = request.args.get('phone')
314
- data = {
315
- "email": email,
316
- "unconfirmed": False,
317
- "values": [
318
- {
319
- "parameter_id": 393120,
320
- "kind": "string",
321
- "list_id": 560775,
322
- "title": "phone",
323
- "value": phone
324
- },
325
- {
326
- "parameter_id": 393119,
327
- "kind": "string",
328
- "list_id": 560775,
329
- "title": "name",
330
- "value": name
331
- }
332
- ]
333
- }
334
- headers = {
335
- 'Authorization': f'Bearer {token}',
336
- 'Content-Type': 'application/json'
337
- }
338
- response = requests.post(f"{base_url}/email/lists/560775/recipients", json=data, headers=headers)
339
-
340
- show_params = False
341
- list_id = 560776
342
- name = request.args.get('name')
343
- email = request.args.get('email')
344
- phone = request.args.get('phone')
345
- data = {
346
- "email": email,
347
- "unconfirmed": False,
348
- "values": [
349
- {
350
- "parameter_id": 393120,
351
- "kind": "string",
352
- "list_id": 560776,
353
- "title": "phone",
354
- "value": phone
355
- },
356
- {
357
- "parameter_id": 393119,
358
- "kind": "string",
359
- "list_id": 560776,
360
- "title": "name",
361
- "value": name
362
- }
363
- ]
364
- }
365
- headers = {
366
- 'Authorization': f'Bearer {token}',
367
- 'Content-Type': 'application/json'
368
- }
369
- response = requests.post(f"{base_url}/email/lists/560776/recipients", json=data, headers=headers)
370
 
371
  else:
372
  # Вечером в среду
373
  # Комментарий: Отправка в лист 1, лист 2, лист 3
374
- show_params = False
375
- list_id = 560777
376
- name = request.args.get('name')
377
- email = request.args.get('email')
378
- phone = request.args.get('phone')
379
- data = {
380
- "email": email,
381
- "unconfirmed": False,
382
- "values": [
383
- {
384
- "parameter_id": 393120,
385
- "kind": "string",
386
- "list_id": 560777,
387
- "title": "phone",
388
- "value": phone
389
- },
390
- {
391
- "parameter_id": 393119,
392
- "kind": "string",
393
- "list_id": 560777,
394
- "title": "name",
395
- "value": name
396
- }
397
- ]
398
- }
399
- headers = {
400
- 'Authorization': f'Bearer {token}',
401
- 'Content-Type': 'application/json'
402
- }
403
- response = requests.post(f"{base_url}/email/lists/560777/recipients", json=data, headers=headers)
404
-
405
- show_params = False
406
- list_id = 560778
407
- name = request.args.get('name')
408
- email = request.args.get('email')
409
- phone = request.args.get('phone')
410
- data = {
411
- "email": email,
412
- "unconfirmed": False,
413
- "values": [
414
- {
415
- "parameter_id": 393120,
416
- "kind": "string",
417
- "list_id": 560778,
418
- "title": "phone",
419
- "value": phone
420
- },
421
- {
422
- "parameter_id": 393119,
423
- "kind": "string",
424
- "list_id": 560778,
425
- "title": "name",
426
- "value": name
427
- }
428
- ]
429
- }
430
- headers = {
431
- 'Authorization': f'Bearer {token}',
432
- 'Content-Type': 'application/json'
433
- }
434
- response = requests.post(f"{base_url}/email/lists/560778/recipients", json=data, headers=headers)
435
-
436
- show_params = False
437
- list_id = 560779
438
- name = request.args.get('name')
439
- email = request.args.get('email')
440
- phone = request.args.get('phone')
441
- data = {
442
- "email": email,
443
- "unconfirmed": False,
444
- "values": [
445
- {
446
- "parameter_id": 393120,
447
- "kind": "string",
448
- "list_id": 560779,
449
- "title": "phone",
450
- "value": phone
451
- },
452
- {
453
- "parameter_id": 393119,
454
- "kind": "string",
455
- "list_id": 560779,
456
- "title": "name",
457
- "value": name
458
- }
459
- ]
460
- }
461
- headers = {
462
- 'Authorization': f'Bearer {token}',
463
- 'Content-Type': 'application/json'
464
- }
465
- response = requests.post(f"{base_url}/email/lists/560779/recipients", json=data, headers=headers)
466
 
467
  elif current_day == 3: # Четверг
468
  if current_hour < 19:
469
  # Утром в четверг
470
  # Комментарий: Отправка в лист 1, лист 2, лист 3
471
- show_params = False
472
- list_id = 560780
473
- name = request.args.get('name')
474
- email = request.args.get('email')
475
- phone = request.args.get('phone')
476
- data = {
477
- "email": email,
478
- "unconfirmed": False,
479
- "values": [
480
- {
481
- "parameter_id": 393120,
482
- "kind": "string",
483
- "list_id": 560780,
484
- "title": "phone",
485
- "value": phone
486
- },
487
- {
488
- "parameter_id": 393119,
489
- "kind": "string",
490
- "list_id": 560780,
491
- "title": "name",
492
- "value": name
493
- }
494
- ]
495
- }
496
- headers = {
497
- 'Authorization': f'Bearer {token}',
498
- 'Content-Type': 'application/json'
499
- }
500
- response = requests.post(f"{base_url}/email/lists/560780/recipients", json=data, headers=headers)
501
-
502
- show_params = False
503
- list_id = 560781
504
- name = request.args.get('name')
505
- email = request.args.get('email')
506
- phone = request.args.get('phone')
507
- data = {
508
- "email": email,
509
- "unconfirmed": False,
510
- "values": [
511
- {
512
- "parameter_id": 393120,
513
- "kind": "string",
514
- "list_id": 560781,
515
- "title": "phone",
516
- "value": phone
517
- },
518
- {
519
- "parameter_id": 393119,
520
- "kind": "string",
521
- "list_id": 560781,
522
- "title": "name",
523
- "value": name
524
- }
525
- ]
526
- }
527
- headers = {
528
- 'Authorization': f'Bearer {token}',
529
- 'Content-Type': 'application/json'
530
- }
531
- response = requests.post(f"{base_url}/email/lists/560781/recipients", json=data, headers=headers)
532
-
533
- show_params = False
534
- list_id = 560782
535
- name = request.args.get('name')
536
- email = request.args.get('email')
537
- phone = request.args.get('phone')
538
- data = {
539
- "email": email,
540
- "unconfirmed": False,
541
- "values": [
542
- {
543
- "parameter_id": 393120,
544
- "kind": "string",
545
- "list_id": 560782,
546
- "title": "phone",
547
- "value": phone
548
- },
549
- {
550
- "parameter_id": 393119,
551
- "kind": "string",
552
- "list_id": 560782,
553
- "title": "name",
554
- "value": name
555
- }
556
- ]
557
- }
558
- headers = {
559
- 'Authorization': f'Bearer {token}',
560
- 'Content-Type': 'application/json'
561
- }
562
- response = requests.post(f"{base_url}/email/lists/560782/recipients", json=data, headers=headers)
563
 
564
  else:
565
  # Вечером в четверг
566
  # Комментарий: Отправка в лист 1, лист 2, лист 3
567
- show_params = False
568
- list_id = 560783
569
- name = request.args.get('name')
570
- email = request.args.get('email')
571
- phone = request.args.get('phone')
572
- data = {
573
- "email": email,
574
- "unconfirmed": False,
575
- "values": [
576
- {
577
- "parameter_id": 393120,
578
- "kind": "string",
579
- "list_id": 560783,
580
- "title": "phone",
581
- "value": phone
582
- },
583
- {
584
- "parameter_id": 393119,
585
- "kind": "string",
586
- "list_id": 560783,
587
- "title": "name",
588
- "value": name
589
- }
590
- ]
591
- }
592
- headers = {
593
- 'Authorization': f'Bearer {token}',
594
- 'Content-Type': 'application/json'
595
- }
596
- response = requests.post(f"{base_url}/email/lists/560783/recipients", json=data, headers=headers)
597
-
598
- show_params = False
599
- list_id = 560784
600
- name = request.args.get('name')
601
- email = request.args.get('email')
602
- phone = request.args.get('phone')
603
- data = {
604
- "email": email,
605
- "unconfirmed": False,
606
- "values": [
607
- {
608
- "parameter_id": 393120,
609
- "kind": "string",
610
- "list_id": 560784,
611
- "title": "phone",
612
- "value": phone
613
- },
614
- {
615
- "parameter_id": 393119,
616
- "kind": "string",
617
- "list_id": 560784,
618
- "title": "name",
619
- "value": name
620
- }
621
- ]
622
- }
623
- headers = {
624
- 'Authorization': f'Bearer {token}',
625
- 'Content-Type': 'application/json'
626
- }
627
- response = requests.post(f"{base_url}/email/lists/560784/recipients", json=data, headers=headers)
628
-
629
- show_params = False
630
- list_id = 560785
631
- name = request.args.get('name')
632
- email = request.args.get('email')
633
- phone = request.args.get('phone')
634
- data = {
635
- "email": email,
636
- "unconfirmed": False,
637
- "values": [
638
- {
639
- "parameter_id": 393120,
640
- "kind": "string",
641
- "list_id": 560785,
642
- "title": "phone",
643
- "value": phone
644
- },
645
- {
646
- "parameter_id": 393119,
647
- "kind": "string",
648
- "list_id": 560785,
649
- "title": "name",
650
- "value": name
651
- }
652
- ]
653
- }
654
- headers = {
655
- 'Authorization': f'Bearer {token}',
656
- 'Content-Type': 'application/json'
657
- }
658
- response = requests.post(f"{base_url}/email/lists/560785/recipients", json=data, headers=headers)
659
 
660
  return response.json()
661
 
 
239
  elif current_day == 1: # Вторник
240
  if current_hour < 19:
241
  # Утром во вторник
242
+
243
+
 
244
  # Возвращаем список ответов
245
  return {'responses': [response_1,response_2,response_3]}
246
  else:
247
  # Вечером во вторник
248
+ save_to_database1(name, email, phone, pr5, pr4, pr3, pr2, pr1)
249
+
 
 
250
 
251
 
252
 
 
272
  if current_hour < 19:
273
  # Утром в среду
274
  # Комментарий: Отправка в лист 1, лист 2, лист 3
275
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
 
277
  else:
278
  # Вечером в среду
279
  # Комментарий: Отправка в лист 1, лист 2, лист 3
280
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
  elif current_day == 3: # Четверг
283
  if current_hour < 19:
284
  # Утром в четверг
285
  # Комментарий: Отправка в лист 1, лист 2, лист 3
286
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
 
288
  else:
289
  # Вечером в четверг
290
  # Комментарий: Отправка в лист 1, лист 2, лист 3
291
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
  return response.json()
294