DmitrMakeev commited on
Commit
6918051
·
verified ·
1 Parent(s): b402861

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +672 -120
app.py CHANGED
@@ -134,139 +134,691 @@ def save_db():
134
 
135
 
136
 
137
-
138
- @app.route('/save_pl', methods=['POST'])
139
- def save_pl():
140
- list_id1 = 560768
141
- list_id2 = 560832
142
- list_id3 = 560833
143
-
144
- data = request.json
145
- name = data.get('name')
146
- email = data.get('email')
147
- phone = data.get('phone')
148
-
149
- current_day = datetime.datetime.today().weekday()
150
-
151
- urls = []
152
-
153
- if current_day in [0, 4, 5, 6]:
154
- urls = [
155
- (f"{base_url}/email/lists/{list_id1}/recipients_mon_fri_sat_sun", {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  "email": email,
157
- "unconfirmed": True,
158
  "values": [
159
- {"parameter_id": 393120, "kind": "string", "list_id": list_id1, "title": "phone", "value": phone},
160
- {"parameter_id": 393119, "kind": "string", "list_id": list_id1, "title": "name", "value": name}
 
 
 
 
 
 
 
 
 
 
 
 
161
  ]
162
- }),
163
- (f"{base_url}/email/lists/{list_id2}/recipients_mon_fri_sat_sun", {
 
 
 
 
 
 
 
 
 
 
 
164
  "email": email,
165
- "unconfirmed": True,
166
  "values": [
167
- {"parameter_id": 393196, "kind": "string", "list_id": list_id2, "title": "phone", "value": phone},
168
- {"parameter_id": 393195, "kind": "string", "list_id": list_id2, "title": "name", "value": name}
 
 
 
 
 
 
 
 
 
 
 
 
169
  ]
170
- }),
171
- (f"{base_url}/email/lists/{list_id3}/recipients_mon_fri_sat_sun", {
 
 
 
 
 
 
 
 
 
 
 
172
  "email": email,
173
- "unconfirmed": True,
174
  "values": [
175
- {"parameter_id": 393198, "kind": "string", "list_id": list_id3, "title": "phone", "value": phone},
176
- {"parameter_id": 393197, "kind": "string", "list_id": list_id3, "title": "name", "value": name}
 
 
 
 
 
 
 
 
 
 
 
 
177
  ]
178
- })
179
- ]
180
- elif current_day == 1:
181
- current_time = datetime.datetime.now().time()
182
- if current_time < datetime.time(19, 0):
183
- urls = [
184
- (f"{base_url}/email/lists/{list_id1}/recipients_tue_morning", {
185
- "email": email,
186
- "unconfirmed": True,
187
- "values": [
188
- {"parameter_id": 393120, "kind": "string", "list_id": list_id1, "title": "phone", "value": phone},
189
- {"parameter_id": 393119, "kind": "string", "list_id": list_id1, "title": "name", "value": name}
190
- ]
191
- })
192
- ]
193
- else:
194
- urls = [
195
- (f"{base_url}/email/lists/{list_id1}/recipients_tue_evening", {
196
- "email": email,
197
- "unconfirmed": False,
198
- "values": [
199
- {"parameter_id": 393120, "kind": "string", "list_id": list_id1, "title": "phone", "value": phone},
200
- {"parameter_id": 393119, "kind": "string", "list_id": list_id1, "title": "name", "value": name}
201
- ]
202
- })
203
- ]
204
- elif current_day == 2:
205
- current_time = datetime.datetime.now().time()
206
- if current_time < datetime.time(19, 0):
207
- urls = [
208
- (f"{base_url}/email/lists/{list_id1}/recipients_wed_morning", {
209
- "email": email,
210
- "unconfirmed": True,
211
- "values": [
212
- {"parameter_id": 393120, "kind": "string", "list_id": list_id1, "title": "phone", "value": phone},
213
- {"parameter_id": 393119, "kind": "string", "list_id": list_id1, "title": "name", "value": name}
214
- ]
215
- })
216
- ]
217
- else:
218
- urls = [
219
- (f"{base_url}/email/lists/{list_id1}/recipients_wed_evening", {
220
- "email": email,
221
- "unconfirmed": False,
222
- "values": [
223
- {"parameter_id": 393120, "kind": "string", "list_id": list_id1, "title": "phone", "value": phone},
224
- {"parameter_id": 393119, "kind": "string", "list_id": list_id1, "title": "name", "value": name}
225
- ]
226
- })
227
- ]
228
- elif current_day == 3:
229
- current_time = datetime.datetime.now().time()
230
- if current_time < datetime.time(19, 0):
231
- urls = [
232
- (f"{base_url}/email/lists/{list_id1}/recipients_thu_morning", {
233
- "email": email,
234
- "unconfirmed": True,
235
- "values": [
236
- {"parameter_id": 393120, "kind": "string", "list_id": list_id1, "title": "phone", "value": phone},
237
- {"parameter_id": 393119, "kind": "string", "list_id": list_id1, "title": "name", "value": name}
238
- ]
239
- })
240
- ]
241
- else:
242
- urls = [
243
- (f"{base_url}/email/lists/{list_id1}/recipients_thu_evening", {
244
- "email": email,
245
- "unconfirmed": False,
246
- "values": [
247
- {"parameter_id": 393120, "kind": "string", "list_id": list_id1, "title": "phone", "value": phone},
248
- {"parameter_id": 393119, "kind": "string", "list_id": list_id1, "title": "name", "value": name}
249
- ]
250
- })
251
- ]
252
 
253
- # Отправляем запросы
254
- responses = []
255
- for url, json_data in urls:
256
- headers = {
257
- 'Authorization': f'Bearer {token}',
258
- 'Content-Type': 'application/json'
259
- }
260
- response = requests.post(url, json=json_data, headers=headers)
261
- responses.append({
262
- 'url': url,
263
- 'status_code': response.status_code,
264
- 'response_text': response.text
265
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
 
267
- return jsonify({'responses': responses})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
 
 
270
 
271
 
272
 
 
134
 
135
 
136
 
137
+ @app.route('/incoming', methods=['POST'])
138
+ def handle_incoming_request():
139
+ # Получаем текущий день недели и время
140
+ current_datetime = datetime.datetime.now()
141
+ current_day = current_datetime.weekday() # 0 - Понедельник, ..., 6 - Воскресенье
142
+ current_hour = current_datetime.hour
143
+
144
+ if current_day in [0, 4, 5, 6]: # Понедельник, Пятница, Суббота, Воскресенье
145
+ # Комментарий: Отправка в лист 1, лист 2, лист 3 днем
146
+ # Лист 1
147
+ show_params = False
148
+ list_id = 560768
149
+ name = request.args.get('name')
150
+ email = request.args.get('email')
151
+ phone = request.args.get('phone')
152
+ data = {
153
+ "email": email,
154
+ "unconfirmed": False,
155
+ "values": [
156
+ {
157
+ "parameter_id": 393120,
158
+ "kind": "string",
159
+ "list_id": 560768,
160
+ "title": "phone",
161
+ "value": phone
162
+ },
163
+ {
164
+ "parameter_id": 393119,
165
+ "kind": "string",
166
+ "list_id": 560768,
167
+ "title": "name",
168
+ "value": name
169
+ }
170
+ ]
171
+ }
172
+ headers = {
173
+ 'Authorization': f'Bearer {token}',
174
+ 'Content-Type': 'application/json'
175
+ }
176
+ response = requests.post(f"{base_url}/email/lists/560768/recipients", json=data, headers=headers)
177
+
178
+ # Лист 2
179
+ show_params = False
180
+ list_id = 560832
181
+ name = request.args.get('name')
182
+ email = request.args.get('email')
183
+ phone = request.args.get('phone')
184
+ data = {
185
+ "email": email,
186
+ "unconfirmed": False,
187
+ "values": [
188
+ {
189
+ "parameter_id": 393120,
190
+ "kind": "string",
191
+ "list_id": 560832,
192
+ "title": "phone",
193
+ "value": phone
194
+ },
195
+ {
196
+ "parameter_id": 393119,
197
+ "kind": "string",
198
+ "list_id": 560832,
199
+ "title": "name",
200
+ "value": name
201
+ }
202
+ ]
203
+ }
204
+ headers = {
205
+ 'Authorization': f'Bearer {token}',
206
+ 'Content-Type': 'application/json'
207
+ }
208
+ response = requests.post(f"{base_url}/email/lists/560832/recipients", json=data, headers=headers)
209
+
210
+ # Лист 3
211
+ show_params = False
212
+ list_id = 560833
213
+ name = request.args.get('name')
214
+ email = request.args.get('email')
215
+ phone = request.args.get('phone')
216
+ data = {
217
+ "email": email,
218
+ "unconfirmed": False,
219
+ "values": [
220
+ {
221
+ "parameter_id": 393120,
222
+ "kind": "string",
223
+ "list_id": 560833,
224
+ "title": "phone",
225
+ "value": phone
226
+ },
227
+ {
228
+ "parameter_id": 393119,
229
+ "kind": "string",
230
+ "list_id": 560833,
231
+ "title": "name",
232
+ "value": name
233
+ }
234
+ ]
235
+ }
236
+ headers = {
237
+ 'Authorization': f'Bearer {token}',
238
+ 'Content-Type': 'application/json'
239
+ }
240
+ response = requests.post(f"{base_url}/email/lists/560833/recipients", json=data, headers=headers)
241
+
242
+ elif current_day == 1: # Вторник
243
+ if current_hour < 19:
244
+ # Утром во вторник
245
+ # Комментарий: Отправка в лист 1, лист 2, лист 3
246
+ show_params = False
247
+ list_id = 560768
248
+ name = request.args.get('name')
249
+ email = request.args.get('email')
250
+ phone = request.args.get('phone')
251
+ data = {
252
  "email": email,
253
+ "unconfirmed": False,
254
  "values": [
255
+ {
256
+ "parameter_id": 393120,
257
+ "kind": "string",
258
+ "list_id": 560768,
259
+ "title": "phone",
260
+ "value": phone
261
+ },
262
+ {
263
+ "parameter_id": 393119,
264
+ "kind": "string",
265
+ "list_id": 560768,
266
+ "title": "name",
267
+ "value": name
268
+ }
269
  ]
270
+ }
271
+ headers = {
272
+ 'Authorization': f'Bearer {token}',
273
+ 'Content-Type': 'application/json'
274
+ }
275
+ response = requests.post(f"{base_url}/email/lists/560768/recipients", json=data, headers=headers)
276
+
277
+ show_params = False
278
+ list_id = 560769
279
+ name = request.args.get('name')
280
+ email = request.args.get('email')
281
+ phone = request.args.get('phone')
282
+ data = {
283
  "email": email,
284
+ "unconfirmed": False,
285
  "values": [
286
+ {
287
+ "parameter_id": 393120,
288
+ "kind": "string",
289
+ "list_id": 560769,
290
+ "title": "phone",
291
+ "value": phone
292
+ },
293
+ {
294
+ "parameter_id": 393119,
295
+ "kind": "string",
296
+ "list_id": 560769,
297
+ "title": "name",
298
+ "value": name
299
+ }
300
  ]
301
+ }
302
+ headers = {
303
+ 'Authorization': f'Bearer {token}',
304
+ 'Content-Type': 'application/json'
305
+ }
306
+ response = requests.post(f"{base_url}/email/lists/560769/recipients", json=data, headers=headers)
307
+
308
+ show_params = False
309
+ list_id = 560770
310
+ name = request.args.get('name')
311
+ email = request.args.get('email')
312
+ phone = request.args.get('phone')
313
+ data = {
314
  "email": email,
315
+ "unconfirmed": False,
316
  "values": [
317
+ {
318
+ "parameter_id": 393120,
319
+ "kind": "string",
320
+ "list_id": 560770,
321
+ "title": "phone",
322
+ "value": phone
323
+ },
324
+ {
325
+ "parameter_id": 393119,
326
+ "kind": "string",
327
+ "list_id": 560770,
328
+ "title": "name",
329
+ "value": name
330
+ }
331
  ]
332
+ }
333
+ headers = {
334
+ 'Authorization': f'Bearer {token}',
335
+ 'Content-Type': 'application/json'
336
+ }
337
+ response = requests.post(f"{base_url}/email/lists/560770/recipients", json=data, headers=headers)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
 
339
+ else:
340
+ # Вечером во вторник
341
+ # Комментарий: Отправка в лист 1, лист 2, лист 3
342
+ show_params = False
343
+ list_id = 560771
344
+ name = request.args.get('name')
345
+ email = request.args.get('email')
346
+ phone = request.args.get('phone')
347
+ data = {
348
+ "email": email,
349
+ "unconfirmed": False,
350
+ "values": [
351
+ {
352
+ "parameter_id": 393120,
353
+ "kind": "string",
354
+ "list_id": 560771,
355
+ "title": "phone",
356
+ "value": phone
357
+ },
358
+ {
359
+ "parameter_id": 393119,
360
+ "kind": "string",
361
+ "list_id": 560771,
362
+ "title": "name",
363
+ "value": name
364
+ }
365
+ ]
366
+ }
367
+ headers = {
368
+ 'Authorization': f'Bearer {token}',
369
+ 'Content-Type': 'application/json'
370
+ }
371
+ response = requests.post(f"{base_url}/email/lists/560771/recipients", json=data, headers=headers)
372
+
373
+ show_params = False
374
+ list_id = 560772
375
+ name = request.args.get('name')
376
+ email = request.args.get('email')
377
+ phone = request.args.get('phone')
378
+ data = {
379
+ "email": email,
380
+ "unconfirmed": False,
381
+ "values": [
382
+ {
383
+ "parameter_id": 393120,
384
+ "kind": "string",
385
+ "list_id": 560772,
386
+ "title": "phone",
387
+ "value": phone
388
+ },
389
+ {
390
+ "parameter_id": 393119,
391
+ "kind": "string",
392
+ "list_id": 560772,
393
+ "title": "name",
394
+ "value": name
395
+ }
396
+ ]
397
+ }
398
+ headers = {
399
+ 'Authorization': f'Bearer {token}',
400
+ 'Content-Type': 'application/json'
401
+ }
402
+ response = requests.post(f"{base_url}/email/lists/560772/recipients", json=data, headers=headers)
403
+
404
+ show_params = False
405
+ list_id = 560773
406
+ name = request.args.get('name')
407
+ email = request.args.get('email')
408
+ phone = request.args.get('phone')
409
+ data = {
410
+ "email": email,
411
+ "unconfirmed": False,
412
+ "values": [
413
+ {
414
+ "parameter_id": 393120,
415
+ "kind": "string",
416
+ "list_id": 560773,
417
+ "title": "phone",
418
+ "value": phone
419
+ },
420
+ {
421
+ "parameter_id": 393119,
422
+ "kind": "string",
423
+ "list_id": 560773,
424
+ "title": "name",
425
+ "value": name
426
+ }
427
+ ]
428
+ }
429
+ headers = {
430
+ 'Authorization': f'Bearer {token}',
431
+ 'Content-Type': 'application/json'
432
+ }
433
+ response = requests.post(f"{base_url}/email/lists/560773/recipients", json=data, headers=headers)
434
+
435
+ elif current_day == 2: # Среда
436
+ if current_hour < 19:
437
+ # Утром в среду
438
+ # Комментарий: Отправка в лист 1, лист 2, лист 3
439
+ show_params = False
440
+ list_id = 560774
441
+ name = request.args.get('name')
442
+ email = request.args.get('email')
443
+ phone = request.args.get('phone')
444
+ data = {
445
+ "email": email,
446
+ "unconfirmed": False,
447
+ "values": [
448
+ {
449
+ "parameter_id": 393120,
450
+ "kind": "string",
451
+ "list_id": 560774,
452
+ "title": "phone",
453
+ "value": phone
454
+ },
455
+ {
456
+ "parameter_id": 393119,
457
+ "kind": "string",
458
+ "list_id": 560774,
459
+ "title": "name",
460
+ "value": name
461
+ }
462
+ ]
463
+ }
464
+ headers = {
465
+ 'Authorization': f'Bearer {token}',
466
+ 'Content-Type': 'application/json'
467
+ }
468
+ response = requests.post(f"{base_url}/email/lists/560774/recipients", json=data, headers=headers)
469
+
470
+ show_params = False
471
+ list_id = 560775
472
+ name = request.args.get('name')
473
+ email = request.args.get('email')
474
+ phone = request.args.get('phone')
475
+ data = {
476
+ "email": email,
477
+ "unconfirmed": False,
478
+ "values": [
479
+ {
480
+ "parameter_id": 393120,
481
+ "kind": "string",
482
+ "list_id": 560775,
483
+ "title": "phone",
484
+ "value": phone
485
+ },
486
+ {
487
+ "parameter_id": 393119,
488
+ "kind": "string",
489
+ "list_id": 560775,
490
+ "title": "name",
491
+ "value": name
492
+ }
493
+ ]
494
+ }
495
+ headers = {
496
+ 'Authorization': f'Bearer {token}',
497
+ 'Content-Type': 'application/json'
498
+ }
499
+ response = requests.post(f"{base_url}/email/lists/560775/recipients", json=data, headers=headers)
500
+
501
+ show_params = False
502
+ list_id = 560776
503
+ name = request.args.get('name')
504
+ email = request.args.get('email')
505
+ phone = request.args.get('phone')
506
+ data = {
507
+ "email": email,
508
+ "unconfirmed": False,
509
+ "values": [
510
+ {
511
+ "parameter_id": 393120,
512
+ "kind": "string",
513
+ "list_id": 560776,
514
+ "title": "phone",
515
+ "value": phone
516
+ },
517
+ {
518
+ "parameter_id": 393119,
519
+ "kind": "string",
520
+ "list_id": 560776,
521
+ "title": "name",
522
+ "value": name
523
+ }
524
+ ]
525
+ }
526
+ headers = {
527
+ 'Authorization': f'Bearer {token}',
528
+ 'Content-Type': 'application/json'
529
+ }
530
+ response = requests.post(f"{base_url}/email/lists/560776/recipients", json=data, headers=headers)
531
 
532
+ else:
533
+ # Вечером в среду
534
+ # Комментарий: Отправка в лист 1, лист 2, лист 3
535
+ show_params = False
536
+ list_id = 560777
537
+ name = request.args.get('name')
538
+ email = request.args.get('email')
539
+ phone = request.args.get('phone')
540
+ data = {
541
+ "email": email,
542
+ "unconfirmed": False,
543
+ "values": [
544
+ {
545
+ "parameter_id": 393120,
546
+ "kind": "string",
547
+ "list_id": 560777,
548
+ "title": "phone",
549
+ "value": phone
550
+ },
551
+ {
552
+ "parameter_id": 393119,
553
+ "kind": "string",
554
+ "list_id": 560777,
555
+ "title": "name",
556
+ "value": name
557
+ }
558
+ ]
559
+ }
560
+ headers = {
561
+ 'Authorization': f'Bearer {token}',
562
+ 'Content-Type': 'application/json'
563
+ }
564
+ response = requests.post(f"{base_url}/email/lists/560777/recipients", json=data, headers=headers)
565
+
566
+ show_params = False
567
+ list_id = 560778
568
+ name = request.args.get('name')
569
+ email = request.args.get('email')
570
+ phone = request.args.get('phone')
571
+ data = {
572
+ "email": email,
573
+ "unconfirmed": False,
574
+ "values": [
575
+ {
576
+ "parameter_id": 393120,
577
+ "kind": "string",
578
+ "list_id": 560778,
579
+ "title": "phone",
580
+ "value": phone
581
+ },
582
+ {
583
+ "parameter_id": 393119,
584
+ "kind": "string",
585
+ "list_id": 560778,
586
+ "title": "name",
587
+ "value": name
588
+ }
589
+ ]
590
+ }
591
+ headers = {
592
+ 'Authorization': f'Bearer {token}',
593
+ 'Content-Type': 'application/json'
594
+ }
595
+ response = requests.post(f"{base_url}/email/lists/560778/recipients", json=data, headers=headers)
596
+
597
+ show_params = False
598
+ list_id = 560779
599
+ name = request.args.get('name')
600
+ email = request.args.get('email')
601
+ phone = request.args.get('phone')
602
+ data = {
603
+ "email": email,
604
+ "unconfirmed": False,
605
+ "values": [
606
+ {
607
+ "parameter_id": 393120,
608
+ "kind": "string",
609
+ "list_id": 560779,
610
+ "title": "phone",
611
+ "value": phone
612
+ },
613
+ {
614
+ "parameter_id": 393119,
615
+ "kind": "string",
616
+ "list_id": 560779,
617
+ "title": "name",
618
+ "value": name
619
+ }
620
+ ]
621
+ }
622
+ headers = {
623
+ 'Authorization': f'Bearer {token}',
624
+ 'Content-Type': 'application/json'
625
+ }
626
+ response = requests.post(f"{base_url}/email/lists/560779/recipients", json=data, headers=headers)
627
+
628
+ elif current_day == 3: # Четверг
629
+ if current_hour < 19:
630
+ # Утром в четверг
631
+ # Комментарий: Отправка в лист 1, лист 2, лист 3
632
+ show_params = False
633
+ list_id = 560780
634
+ name = request.args.get('name')
635
+ email = request.args.get('email')
636
+ phone = request.args.get('phone')
637
+ data = {
638
+ "email": email,
639
+ "unconfirmed": False,
640
+ "values": [
641
+ {
642
+ "parameter_id": 393120,
643
+ "kind": "string",
644
+ "list_id": 560780,
645
+ "title": "phone",
646
+ "value": phone
647
+ },
648
+ {
649
+ "parameter_id": 393119,
650
+ "kind": "string",
651
+ "list_id": 560780,
652
+ "title": "name",
653
+ "value": name
654
+ }
655
+ ]
656
+ }
657
+ headers = {
658
+ 'Authorization': f'Bearer {token}',
659
+ 'Content-Type': 'application/json'
660
+ }
661
+ response = requests.post(f"{base_url}/email/lists/560780/recipients", json=data, headers=headers)
662
+
663
+ show_params = False
664
+ list_id = 560781
665
+ name = request.args.get('name')
666
+ email = request.args.get('email')
667
+ phone = request.args.get('phone')
668
+ data = {
669
+ "email": email,
670
+ "unconfirmed": False,
671
+ "values": [
672
+ {
673
+ "parameter_id": 393120,
674
+ "kind": "string",
675
+ "list_id": 560781,
676
+ "title": "phone",
677
+ "value": phone
678
+ },
679
+ {
680
+ "parameter_id": 393119,
681
+ "kind": "string",
682
+ "list_id": 560781,
683
+ "title": "name",
684
+ "value": name
685
+ }
686
+ ]
687
+ }
688
+ headers = {
689
+ 'Authorization': f'Bearer {token}',
690
+ 'Content-Type': 'application/json'
691
+ }
692
+ response = requests.post(f"{base_url}/email/lists/560781/recipients", json=data, headers=headers)
693
+
694
+ show_params = False
695
+ list_id = 560782
696
+ name = request.args.get('name')
697
+ email = request.args.get('email')
698
+ phone = request.args.get('phone')
699
+ data = {
700
+ "email": email,
701
+ "unconfirmed": False,
702
+ "values": [
703
+ {
704
+ "parameter_id": 393120,
705
+ "kind": "string",
706
+ "list_id": 560782,
707
+ "title": "phone",
708
+ "value": phone
709
+ },
710
+ {
711
+ "parameter_id": 393119,
712
+ "kind": "string",
713
+ "list_id": 560782,
714
+ "title": "name",
715
+ "value": name
716
+ }
717
+ ]
718
+ }
719
+ headers = {
720
+ 'Authorization': f'Bearer {token}',
721
+ 'Content-Type': 'application/json'
722
+ }
723
+ response = requests.post(f"{base_url}/email/lists/560782/recipients", json=data, headers=headers)
724
 
725
+ else:
726
+ # Вечером в четверг
727
+ # Комментарий: Отправка в лист 1, лист 2, лист 3
728
+ show_params = False
729
+ list_id = 560783
730
+ name = request.args.get('name')
731
+ email = request.args.get('email')
732
+ phone = request.args.get('phone')
733
+ data = {
734
+ "email": email,
735
+ "unconfirmed": False,
736
+ "values": [
737
+ {
738
+ "parameter_id": 393120,
739
+ "kind": "string",
740
+ "list_id": 560783,
741
+ "title": "phone",
742
+ "value": phone
743
+ },
744
+ {
745
+ "parameter_id": 393119,
746
+ "kind": "string",
747
+ "list_id": 560783,
748
+ "title": "name",
749
+ "value": name
750
+ }
751
+ ]
752
+ }
753
+ headers = {
754
+ 'Authorization': f'Bearer {token}',
755
+ 'Content-Type': 'application/json'
756
+ }
757
+ response = requests.post(f"{base_url}/email/lists/560783/recipients", json=data, headers=headers)
758
+
759
+ show_params = False
760
+ list_id = 560784
761
+ name = request.args.get('name')
762
+ email = request.args.get('email')
763
+ phone = request.args.get('phone')
764
+ data = {
765
+ "email": email,
766
+ "unconfirmed": False,
767
+ "values": [
768
+ {
769
+ "parameter_id": 393120,
770
+ "kind": "string",
771
+ "list_id": 560784,
772
+ "title": "phone",
773
+ "value": phone
774
+ },
775
+ {
776
+ "parameter_id": 393119,
777
+ "kind": "string",
778
+ "list_id": 560784,
779
+ "title": "name",
780
+ "value": name
781
+ }
782
+ ]
783
+ }
784
+ headers = {
785
+ 'Authorization': f'Bearer {token}',
786
+ 'Content-Type': 'application/json'
787
+ }
788
+ response = requests.post(f"{base_url}/email/lists/560784/recipients", json=data, headers=headers)
789
+
790
+ show_params = False
791
+ list_id = 560785
792
+ name = request.args.get('name')
793
+ email = request.args.get('email')
794
+ phone = request.args.get('phone')
795
+ data = {
796
+ "email": email,
797
+ "unconfirmed": False,
798
+ "values": [
799
+ {
800
+ "parameter_id": 393120,
801
+ "kind": "string",
802
+ "list_id": 560785,
803
+ "title": "phone",
804
+ "value": phone
805
+ },
806
+ {
807
+ "parameter_id": 393119,
808
+ "kind": "string",
809
+ "list_id": 560785,
810
+ "title": "name",
811
+ "value": name
812
+ }
813
+ ]
814
+ }
815
+ headers = {
816
+ 'Authorization': f'Bearer {token}',
817
+ 'Content-Type': 'application/json'
818
+ }
819
+ response = requests.post(f"{base_url}/email/lists/560785/recipients", json=data, headers=headers)
820
 
821
+ return response.json()
822
 
823
 
824