lazyad 0.0.40__tar.gz → 0.0.42__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.40
3
+ Version: 0.0.42
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -24,6 +24,7 @@ default_headers = {
24
24
  "TE": "trailers",
25
25
  "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0"
26
26
  }
27
+ default_timeout = 60
27
28
 
28
29
 
29
30
  def auth(
@@ -122,45 +123,79 @@ def offers(
122
123
 
123
124
  def performance(
124
125
  cookie: str,
126
+ total: bool = False,
127
+
125
128
  page: int = 1,
126
129
  page_size: int = 50,
127
130
  timezone: int = 8,
128
131
  start_time: str = None,
129
132
  end_time: str = None,
130
133
  show_calendar_day: int = 2,
131
- total: bool = False,
132
134
  breakdowns: list = None,
133
- metrics: list = None
135
+ metrics: list = None,
136
+ sort: str = None,
137
+ order: str = "DESC",
138
+ adv_campaign_id: int = None,
139
+ timeout: int = default_timeout
134
140
  ):
135
141
  """
136
142
  获取广告单元列表
137
143
  需要登录:{'code': 400, 'msg': 'Please login first', 'data': None}
138
144
  验证成功:{'code': 200, 'msg': 'success', 'data': {}
145
+ :param start_time: 开始日期,例如:2025-03-05
146
+ :param end_time: 结束日期,例如:2025-03-05
147
+ :param breakdowns: 分组依据(高级选项):[]
148
+ (date:天, timestamp:小时,week:周,month:月)
149
+ adv_offer_id:广告单元,
150
+ bid_type:Bid Type,
151
+ country_code:国家或地区
152
+ app:应用id(子渠道)
153
+ package_name:包名(子渠道)
154
+ app_name:应用名称(子渠道)
155
+ adv_campaign_id:广告
156
+ received_price:单价
157
+ ad_type:广告类型
158
+ :param sort: [可选-排序] 排序依据(高级选项):adv_install:转化
159
+ :param adv_campaign_id: [可选-筛选]广告名称
139
160
  """
140
161
  scheme = "https"
141
162
  host = "ss-api.mintegral.com"
142
- filename = "/api/v1/reports/performance"
143
- filename_total = "/api/v1/reports/performance-total"
163
+ filename = "/api/v1/reports/performance" # 获取详细数据
164
+ filename_total = "/api/v1/reports/performance-total" # 获取总数据数据量,该请求优先
165
+
144
166
  if not start_time:
145
167
  start_time = lazytime.get_date_string(days=0)
146
168
  if not end_time:
147
169
  end_time = lazytime.get_date_string(days=0)
148
- if not breakdowns:
149
- breakdowns = ["date", "adv_offer_id"]
150
- if not metrics:
170
+ if not breakdowns: # 数据维度
171
+ breakdowns = [
172
+ "date",
173
+ "adv_offer_id"
174
+ ]
175
+ if not metrics: # 数据指标
151
176
  metrics = [
152
- "adv_impression",
153
- "adv_click",
154
- "adv_install",
155
- "ecpm",
156
- "ecpc",
157
- "ecpi",
158
- "ctr",
159
- "ivr",
160
- "cvr",
161
- "adv_original_money",
162
- "iaa_d0_ad_revenue",
163
- "iaa_d0_roas"
177
+ "adv_impression", # 展示
178
+ "adv_click", # 点击
179
+ "adv_install", # 转化
180
+ "ecpm", # eCPM
181
+ "ecpc", # CPC
182
+ "ecpi", # eCPI
183
+ "ctr", # CTR
184
+ "ivr", # IVR
185
+ "cvr", # CVR
186
+ "adv_original_money", # 花费
187
+ "iaa_d0_ad_revenue", # D0 Ad Rev
188
+ "iaa_d0_roas", # D0 Ad Roas
189
+ "iaa_d3_ad_revenue", # D3 Ad Rev
190
+ "iaa_d3_roas", # D3 Ad Roas
191
+ "iaa_d7_ad_revenue", # D7 Ad Rev
192
+ "iaa_d7_roas", # D7 Ad Roas
193
+ # "iap_d0_ad_revenue", # D0 IAP Rev
194
+ # "iap_d0_roas", # D0 IAP Roas
195
+ # "iap_d3_ad_revenue", # D3 IAP Rev
196
+ # "iap_d3_roas", # D3 IAP Roas
197
+ # "iap_d7_ad_revenue", # D7 IAP Rev
198
+ # "iap_d7_roas", # D7 IAP Roas
164
199
  ]
165
200
  params = {
166
201
  "limit": page_size,
@@ -168,26 +203,28 @@ def performance(
168
203
  "timezone": timezone,
169
204
  "start_time": start_time,
170
205
  "end_time": end_time,
171
- "order": "DESC",
206
+ "order": order, # 排序
172
207
  "breakdowns": ",".join(breakdowns),
173
208
  "metrics": ",".join(metrics),
174
209
  "show_calendar_day": show_calendar_day
175
210
  }
176
- url = f"{scheme}://{host}{filename}"
177
- url_total = f"{scheme}://{host}{filename_total}"
211
+ if sort:
212
+ params["sort"] = sort
178
213
  headers = copy.deepcopy(default_headers)
179
214
  headers["Cookie"] = cookie
180
215
  if total:
181
216
  return lazyrequests.lazy_requests(
182
217
  method="GET",
183
218
  params=params,
184
- url=url_total,
185
- headers=headers
219
+ url=f"{scheme}://{host}{filename_total}",
220
+ headers=headers,
221
+ timeout=timeout
186
222
  )
187
223
  else:
188
224
  return lazyrequests.lazy_requests(
189
225
  method="GET",
190
226
  params=params,
191
- url=url,
192
- headers=headers
227
+ url=f"{scheme}://{host}{filename}",
228
+ headers=headers,
229
+ timeout=timeout
193
230
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.40
3
+ Version: 0.0.42
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.40",
16
+ version="0.0.42",
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