lazyad 0.0.71__tar.gz → 0.0.73__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.71
3
+ Version: 0.0.73
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -362,6 +362,7 @@ def update_ad_batch(
362
362
  ):
363
363
  """
364
364
  暂停广告
365
+ : param operate: 操作:暂停:DISABLE,删除:DELETE
365
366
  :return:
366
367
  """
367
368
  headers = copy.deepcopy(default_headers)
@@ -604,7 +605,8 @@ def get_account_report(
604
605
  conditions: dict = None,
605
606
  kpis: list = None,
606
607
  base_infos: list = None,
607
- time_line: str = "REPORTING_TIME"
608
+ time_line: str = "REPORTING_TIME",
609
+ host: str = "cli2.mobgi.com",
608
610
  ):
609
611
  """
610
612
  推广-广告管理-媒体账户
@@ -625,7 +627,7 @@ def get_account_report(
625
627
  start_date = lazytime.get_date_string(days=0)
626
628
  if not end_date:
627
629
  end_date = lazytime.get_date_string(days=0)
628
- url = "https://cli2.mobgi.com/MainPanelReport/AccountReport/getReport"
630
+ url = f"https://{host}/MainPanelReport/AccountReport/getReport"
629
631
  data = {
630
632
  "data_type": data_type,
631
633
  "media_type": media_type,
@@ -1035,7 +1037,7 @@ def MainPanelReport_AdReport_getReport(
1035
1037
  base_infos: list = None,
1036
1038
  search_field: str = None,
1037
1039
  search_keyword: str = None,
1038
- time_line: str = "REPORTING_TIME",
1040
+ time_line: str = None,
1039
1041
 
1040
1042
  scheme: str = "https",
1041
1043
  host: str = default_host,
@@ -1054,7 +1056,6 @@ def MainPanelReport_AdReport_getReport(
1054
1056
  :param sort_direction: 排序方式,desc:降序
1055
1057
  :param data_type:
1056
1058
  :param conditions: 搜索条件
1057
- :param advertiser_id: 账户id
1058
1059
  :param cdt_start_date: 创建开始时间
1059
1060
  :param cdt_end_date: 创建结束时间
1060
1061
  :param kpis:
@@ -1072,32 +1073,52 @@ def MainPanelReport_AdReport_getReport(
1072
1073
  cdt_end_date = lazytime.get_date_string(days=0)
1073
1074
  if not base_infos:
1074
1075
  base_infos = [
1075
- "adgroup_name",
1076
- "adgroup_id",
1077
- "advertiser_id",
1078
- "company",
1079
- "optimization_goal",
1080
- "system_status",
1081
- "bid_amount",
1082
- "deep_conversion_worth_roi",
1083
- "created_time",
1084
- "user_name",
1085
- "daily_budget",
1086
- "bid_mode",
1087
- "deep_conversion_spec",
1088
- "begin_date"
1089
- ]
1090
- data = {
1091
- "start_date": start_date,
1092
- "end_date": end_date,
1093
- "page": page,
1094
- "page_size": page_size,
1095
- "sort_field": sort_field,
1096
- "sort_direction": sort_direction,
1097
- "data_type": data_type,
1098
- "base_infos": base_infos,
1099
- "time_line": time_line
1100
- }
1076
+ "adgroup_name",
1077
+ "adgroup_id",
1078
+ "advertiser_id",
1079
+ "company",
1080
+ "optimization_goal",
1081
+ "system_status",
1082
+ "bid_amount",
1083
+ "deep_conversion_worth_roi",
1084
+ "created_time",
1085
+ "user_name",
1086
+ "daily_budget",
1087
+ "bid_mode",
1088
+ "deep_conversion_spec",
1089
+ "begin_date"
1090
+ ]
1091
+
1092
+ data = dict()
1093
+
1094
+ # 默认参数
1095
+ if base_infos:
1096
+ data["base_infos"] = base_infos
1097
+ if conditions:
1098
+ data["conditions"] = conditions
1099
+ if data_type:
1100
+ data["data_type"] = data_type
1101
+ if end_date:
1102
+ data["end_date"] = end_date
1103
+ if kpis:
1104
+ data["kpis"] = kpis
1105
+ if media_type:
1106
+ data["media_type"] = media_type
1107
+ if page:
1108
+ data["page"] = page
1109
+ if page_size:
1110
+ data["page_size"] = page_size
1111
+ if sort_direction:
1112
+ data["sort_direction"] = sort_direction
1113
+ if sort_field:
1114
+ data["sort_field"] = sort_field
1115
+ if start_date:
1116
+ data["start_date"] = start_date
1117
+ if time_line:
1118
+ data["time_line"] = time_line
1119
+ if req_source:
1120
+ data["req_source"] = req_source
1121
+
1101
1122
  if media_type == "baidu":
1102
1123
  if not conditions:
1103
1124
  conditions = {
@@ -1114,7 +1135,10 @@ def MainPanelReport_AdReport_getReport(
1114
1135
  if media_account_id:
1115
1136
  conditions["media_account_id"] = [media_account_id]
1116
1137
  data["conditions"] = json.dumps(conditions)
1138
+
1117
1139
  elif media_type in ["gdt_new", "gdt_upgrade"]:
1140
+ if not time_line:
1141
+ time_line = "REPORTING_TIME"
1118
1142
  if not conditions:
1119
1143
  conditions = {
1120
1144
  "is_deleted": "",
@@ -1132,12 +1156,53 @@ def MainPanelReport_AdReport_getReport(
1132
1156
  "time_line": time_line,
1133
1157
  }
1134
1158
  data["conditions"] = json.dumps(conditions)
1135
- if kpis:
1136
- data["kpis"] = kpis
1137
- if req_source:
1138
- data["req_source"] = req_source
1159
+ if time_line:
1160
+ data["time_line"] = time_line
1139
1161
  else:
1140
- return
1162
+ pass
1163
+ headers = copy.deepcopy(default_headers)
1164
+ headers["Cookie"] = cookie
1165
+ return lazyrequests.lazy_requests(
1166
+ method="POST",
1167
+ url=url,
1168
+ json=data,
1169
+ headers=headers
1170
+ )
1171
+
1172
+
1173
+ def Advertiser_getRealAdvertiserData(
1174
+ cookie: str,
1175
+ start_date: str = None,
1176
+ end_date: str = None,
1177
+ media_account_ids: list = None,
1178
+ conditions: str = None,
1179
+ scheme: str = "https",
1180
+ host: str = default_host,
1181
+ filename: str = "/Toutiao/Advertiser/getRealAdvertiserData"
1182
+ ):
1183
+ """
1184
+ 推广-广告管理-广告 获取最新的广告数据
1185
+ :param cookie:
1186
+ :param start_date: 数据开始日期
1187
+ :param end_date: 数据结束日期
1188
+ :return:
1189
+ """
1190
+ url = f"{scheme}://{host}{filename}"
1191
+ if not start_date:
1192
+ start_date = lazytime.get_date_string(days=0)
1193
+ if not end_date:
1194
+ end_date = lazytime.get_date_string(days=0)
1195
+
1196
+ if not conditions and media_account_ids:
1197
+ conditions_list = list()
1198
+ for each_media_account_id in media_account_ids:
1199
+ conditions_list.append({"media_account_id": str(each_media_account_id)})
1200
+ conditions = json.dumps(conditions_list)
1201
+ data = {
1202
+ "conditions": conditions,
1203
+ "start_date": start_date,
1204
+ "end_date": end_date
1205
+ }
1141
1206
  headers = copy.deepcopy(default_headers)
1142
1207
  headers["Cookie"] = cookie
1143
1208
  return lazyrequests.lazy_requests(
@@ -284,6 +284,7 @@ def performance(
284
284
  timeout=timeout
285
285
  )
286
286
 
287
+
287
288
  def sanitize_entities(
288
289
  xml_content
289
290
  ):
@@ -381,3 +382,134 @@ def history(
381
382
  url=url,
382
383
  headers=headers
383
384
  )
385
+
386
+
387
+ def reports(
388
+ cookie: str,
389
+ url_filename: str,
390
+ total: bool = False,
391
+
392
+ page: int = 1,
393
+ page_size: int = 50,
394
+ timezone: int = 8,
395
+ start_time: str = None,
396
+ end_time: str = None,
397
+ show_calendar_day: int = 2,
398
+ breakdowns: list = None,
399
+ metrics: list = None,
400
+ sort: str = None,
401
+ order: str = "DESC",
402
+ adv_campaign_id: int = None,
403
+ promote_country_code: str = None,
404
+ timeout: int = default_timeout,
405
+ stream: bool = False,
406
+
407
+ ):
408
+ """
409
+ 获取 报表中心报表
410
+ 需要登录:{'code': 400, 'msg': 'Please login first', 'data': None}
411
+ 验证成功:{'code': 200, 'msg': 'success', 'data': {}
412
+ :param cookie: 已经登陆的cookie
413
+ :param url_filename: 具体地址,例如:/api/v1/reports/creative
414
+
415
+ :param total: 为True时获取总记录数
416
+ :param export: 为True时下载表格文件
417
+ :param page: 页码
418
+ :param page_size: 每页数量
419
+ :param timezone: 时区
420
+ :param start_time: 开始日期,例如:2025-03-05
421
+ :param end_time: 结束日期,例如:2025-03-05
422
+ :param show_calendar_day:
423
+ :param breakdowns: 分组依据(高级选项):[]
424
+ (date:天, timestamp:小时,week:周,month:月)
425
+ adv_offer_id:广告单元,
426
+ bid_type:Bid Type,
427
+ country_code:国家或地区
428
+ app:应用id(子渠道)
429
+ package_name:包名(子渠道)
430
+ app_name:应用名称(子渠道)
431
+ adv_campaign_id:广告
432
+ received_price:单价
433
+ ad_type:广告类型
434
+ :param metrics: 展示数据列(高级选项):[]
435
+ "adv_impression", # 展示
436
+ "adv_click", # 点击
437
+ "adv_install", # 转化
438
+ "ecpm", # eCPM
439
+ "ecpc", # CPC
440
+ "ecpi", # eCPI
441
+ "ctr", # CTR
442
+ "ivr", # IVR
443
+ "cvr", # CVR
444
+ "adv_original_money", # 花费
445
+ "iaa_d0_ad_revenue", # D0 Ad Rev
446
+ "iaa_d0_roas", # D0 Ad Roas
447
+ "iaa_d3_ad_revenue", # D3 Ad Rev
448
+ "iaa_d3_roas", # D3 Ad Roas
449
+ "iaa_d7_ad_revenue", # D7 Ad Rev
450
+ "iaa_d7_roas", # D7 Ad Roas
451
+ "iap_d0_ad_revenue", # D0 IAP Rev
452
+ "iap_d0_roas", # D0 IAP Roas
453
+ "iap_d3_ad_revenue", # D3 IAP Rev
454
+ "iap_d3_roas", # D3 IAP Roas
455
+ "iap_d7_ad_revenue", # D7 IAP Rev
456
+ "iap_d7_roas", # D7 IAP Roas
457
+ :param sort: [可选-排序] 排序依据(高级选项):adv_install:转化
458
+ :param order:
459
+ :param adv_campaign_id: [可选-筛选]广告名称
460
+ :param promote_country_code: [可选-筛选]投放区域
461
+ :param timeout: 超时时间
462
+ :param stream: 为True时为流式下载
463
+ """
464
+ scheme = "https"
465
+ host = "ss-api.mintegral.com"
466
+
467
+ if not start_time:
468
+ start_time = lazytime.get_date_string(days=0)
469
+ if not end_time:
470
+ end_time = lazytime.get_date_string(days=0)
471
+ if not breakdowns: # 数据维度
472
+ breakdowns = [
473
+ "date",
474
+ "adv_offer_id"
475
+ ]
476
+ if not metrics: # 数据指标
477
+ metrics = [
478
+ "adv_impression", # 展示
479
+ "adv_click", # 点击
480
+ "adv_install", # 转化
481
+ "ecpm", # eCPM
482
+ "ecpc", # CPC
483
+ "ecpi", # eCPI
484
+ "ctr", # CTR
485
+ "ivr", # IVR
486
+ "cvr", # CVR
487
+ "adv_original_money", # 花费
488
+ "iaa_d0_ad_revenue", # D0 Ad Rev
489
+ "iaa_d0_roas", # D0 Ad Roas
490
+ ]
491
+ params = {
492
+ "limit": page_size,
493
+ "page": page,
494
+ "timezone": timezone,
495
+ "start_time": start_time,
496
+ "end_time": end_time,
497
+ "order": order, # 排序
498
+ "breakdowns": ",".join(breakdowns),
499
+ "metrics": ",".join(metrics),
500
+ "show_calendar_day": show_calendar_day
501
+ }
502
+ if sort:
503
+ params["sort"] = sort
504
+ if adv_campaign_id:
505
+ params["adv_campaign_id"] = adv_campaign_id
506
+ headers = copy.deepcopy(default_headers)
507
+ headers["Cookie"] = cookie
508
+
509
+ return lazyrequests.lazy_requests(
510
+ method="GET",
511
+ params=params,
512
+ url=f"{scheme}://{host}{url_filename}",
513
+ headers=headers,
514
+ timeout=timeout
515
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.71
3
+ Version: 0.0.73
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.71",
16
+ version="0.0.73",
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
File without changes
File without changes
File without changes