lazyad 0.0.22__tar.gz → 0.0.24__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lazyad might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -319,7 +319,10 @@ def update_ad_batch(
319
319
  advertiser_ids: list = None,
320
320
  campaign_id: int = None,
321
321
  campaign_ids: list = None,
322
- field: str = "disable"
322
+ adgroup_feed_id: int = None,
323
+ adgroup_feed_ids: list = None,
324
+ field: str = "disable",
325
+ operate: str = "disable"
323
326
  ):
324
327
  """
325
328
  暂停广告
@@ -354,6 +357,15 @@ def update_ad_batch(
354
357
  }
355
358
  else:
356
359
  return
360
+ elif media_type == "baidu":
361
+ url = "https://cli2.mobgi.com/Baidu/AdGroup/batchUpdate"
362
+ if not adgroup_feed_ids:
363
+ adgroup_feed_ids = [adgroup_feed_id]
364
+ post_data = {
365
+ "adgroup_feed_ids": adgroup_feed_ids,
366
+ "opt_status": operate
367
+ }
368
+
357
369
  else:
358
370
  return
359
371
  return lazyrequests.lazy_requests(
@@ -362,3 +374,131 @@ def update_ad_batch(
362
374
  json=post_data,
363
375
  headers=headers
364
376
  )
377
+
378
+
379
+ def get_material_report(
380
+ cookie: str,
381
+ start_date: str = None,
382
+ end_date: str = None,
383
+ page: int = 1,
384
+ page_size: int = 20,
385
+ media_type: str = "aggregate",
386
+ kpis: list = None,
387
+ sort_field: str = None,
388
+ time_dim: str = "days",
389
+ data_dim: str = "material",
390
+ data_type: str = "list",
391
+ sort_direction: str = "desc",
392
+ conditions: dict = None,
393
+ relate_dims: list = None
394
+ ):
395
+ """
396
+ 报表-素材报表
397
+ :param cookie:
398
+ :param start_date:
399
+ :param end_date:
400
+ :param page:
401
+ :param page_size:
402
+ :param media_type:媒体:gdt_new|广点通(新指标体系),toutiao_upgrade|今日头条2.0,aggregate|不限,baidu:百度信息流
403
+ :param data_dim:
404
+ :param data_type:
405
+ :param sort_direction:
406
+ :param sort_field:
407
+ :param time_dim: 时间维度的数据汇总方式,days:分日,sum:汇总
408
+ :param conditions:
409
+ :param kpis:
410
+ :param relate_dims:
411
+ :return:
412
+ """
413
+ if not start_date:
414
+ start_date = lazytime.get_date_string(days=0)
415
+ if not end_date:
416
+ end_date = lazytime.get_date_string(days=0)
417
+ url = "https://cli2.mobgi.com/ReportV23/MaterialReport/getReport"
418
+ data = {
419
+ "time_dim": time_dim,
420
+ "media_type": media_type,
421
+ "data_type": data_type,
422
+ "data_dim": data_dim,
423
+ "sort_field": sort_field,
424
+ "sort_direction": sort_direction,
425
+ "start_date": start_date,
426
+ "end_date": end_date,
427
+ "page": page,
428
+ "page_size": page_size
429
+ }
430
+ if media_type == "baidu":
431
+ if not conditions:
432
+ conditions = {
433
+ "search_type": "name",
434
+ "media_project_id": [],
435
+ "material_special_id": [],
436
+ "make_user_id": [],
437
+ "advertiser_id": [],
438
+ "owner_user_id": [],
439
+ "media_advertiser_company": [],
440
+ "material_type": "",
441
+ "label_ids": [],
442
+ "material_group_id": []
443
+ }
444
+ if not kpis:
445
+ kpis = [
446
+ "cost",
447
+ "weixinfollowsuccessconversions",
448
+ "weixinfollowsuccessconversionscost",
449
+ "payreaduv",
450
+ "payreaduvcost"
451
+ ]
452
+ if not relate_dims:
453
+ relate_dims = [
454
+ "material_create_time",
455
+ "owner_user_id",
456
+ "creative_user_id",
457
+ "adgroup_feed_id"
458
+ ]
459
+ elif media_type == "gdt_new":
460
+ if not conditions:
461
+ conditions = {
462
+ "advertiser_id": [],
463
+ "label_ids": [],
464
+ "make_user_id": [],
465
+ "material_group_id": [],
466
+ "material_special_id": [],
467
+ "material_type": "",
468
+ "media_advertiser_company": [],
469
+ "media_project_id": [],
470
+ "owner_user_id": [],
471
+ "search_type": "name"
472
+ }
473
+ if not kpis:
474
+ kpis = [
475
+ "cost",
476
+ "cheout_fd",
477
+ "cheout_fd_reward",
478
+ "first_pay_count",
479
+ "first_pay_cost",
480
+ "conversions_count",
481
+ "conversions_cost",
482
+ "from_follow_uv",
483
+ "from_follow_cost",
484
+ "thousand_display_price"
485
+ ]
486
+ if not relate_dims:
487
+ relate_dims = []
488
+ else:
489
+ pass
490
+
491
+ if conditions:
492
+ data["conditions"] = conditions
493
+ if kpis:
494
+ data["kpis"] = kpis
495
+ if relate_dims:
496
+ data["relate_dims"] = relate_dims
497
+ headers = copy.deepcopy(default_headers)
498
+ headers["Cookie"] = cookie
499
+ return lazyrequests.lazy_requests(
500
+ method="POST",
501
+ url=url,
502
+ json=data,
503
+ headers=headers
504
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -13,7 +13,7 @@ with open("README.md", "r", encoding='utf-8') as fh:
13
13
 
14
14
  setuptools.setup(
15
15
  name="lazyad",
16
- version="0.0.22",
16
+ version="0.0.24",
17
17
  description="基于Python的懒人包-适用于广告投放模块",
18
18
  long_description=long_description,
19
19
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes