lazyad 0.0.38__py3-none-any.whl → 0.0.41__py3-none-any.whl

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.

@@ -0,0 +1,226 @@
1
+ from lazysdk import lazyrequests
2
+ from lazysdk import lazytime
3
+ import copy
4
+
5
+
6
+ """
7
+ 官网:https://adv.mintegral.com/cn/login
8
+ """
9
+ default_headers = {
10
+ "Accept": "application/json, text/plain, */*",
11
+ "Accept-Encoding": "gzip, deflated",
12
+ "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
13
+ "Cache-Control": "no-cache",
14
+ "Connection": "keep-alive",
15
+ "Cookie": "",
16
+ "Host": "ss-api.mintegral.com",
17
+ "Origin": "https://adv.mintegral.com",
18
+ "Pragma": "no-cache",
19
+ "Referer": "https://adv.mintegral.com/cn/login",
20
+ "Sec-Fetch-Dest": "empty",
21
+ "Sec-Fetch-Mode": "cors",
22
+ "Sec-Fetch-Site": "same-site",
23
+ "Sec-GPC": "1",
24
+ "TE": "trailers",
25
+ "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0"
26
+ }
27
+
28
+
29
+ def auth(
30
+ cookie: str
31
+ ):
32
+ """
33
+ 验证cookie是否有效
34
+ 需要登录:{'code': 400, 'msg': 'Please login first', 'data': None}
35
+ 验证成功:{'code': 200, 'msg': 'success', 'data': {}
36
+
37
+ """
38
+ url = "https://ss-api.mintegral.com/api/v1/auth"
39
+ headers = copy.deepcopy(default_headers)
40
+ headers["Cookie"] = cookie
41
+ return lazyrequests.lazy_requests(
42
+ method="GET",
43
+ url=url,
44
+ headers=headers
45
+ )
46
+
47
+
48
+ def options(
49
+ cookie: str
50
+ ):
51
+ """
52
+ 获取系统的基本选项
53
+ 需要登录:{'code': 400, 'msg': 'Please login first', 'data': None}
54
+ 验证成功:
55
+ {
56
+ 'code': 200,
57
+ 'msg': 'success',
58
+ 'data': {
59
+ 'offer': ...,
60
+ 'campaign': ...,
61
+ ...
62
+ }
63
+ }
64
+ """
65
+ scheme = "https"
66
+ host = "ss-api.mintegral.com"
67
+ filename = "/api/v1/options/_batch"
68
+ params = {
69
+ "query": "offer,campaign,offer-status,billing-type,country,timezone,country-region-city"
70
+ }
71
+ url = f"{scheme}://{host}{filename}"
72
+ headers = copy.deepcopy(default_headers)
73
+ headers["Cookie"] = cookie
74
+ return lazyrequests.lazy_requests(
75
+ method="GET",
76
+ params=params,
77
+ url=url,
78
+ headers=headers
79
+ )
80
+
81
+
82
+ def offers(
83
+ cookie: str,
84
+ offer_id: int = None,
85
+ method: str = "GET",
86
+ put_data: dict = None,
87
+ page: int = 1,
88
+ page_size: int = 50
89
+ ):
90
+ """
91
+ 获取广告单元列表
92
+ 需要登录:{'code': 400, 'msg': 'Please login first', 'data': None}
93
+ 验证成功:{'code': 200, 'msg': 'success', 'data': {}
94
+ """
95
+ scheme = "https"
96
+ host = "ss-api.mintegral.com"
97
+ if not offer_id:
98
+ filename = "/api/v1/offers"
99
+ params = {
100
+ "limit": page_size,
101
+ "page": page,
102
+ "order": "DESC",
103
+ "sort": "id"
104
+ }
105
+ else:
106
+ filename = f"/api/v1/offers/{offer_id}"
107
+ if method == "PUT":
108
+ params = put_data
109
+ else:
110
+ params = {}
111
+
112
+ url = f"{scheme}://{host}{filename}"
113
+ headers = copy.deepcopy(default_headers)
114
+ headers["Cookie"] = cookie
115
+ return lazyrequests.lazy_requests(
116
+ method=method,
117
+ params=params,
118
+ url=url,
119
+ headers=headers
120
+ )
121
+
122
+
123
+ def performance(
124
+ cookie: str,
125
+ total: bool = False,
126
+
127
+ page: int = 1,
128
+ page_size: int = 50,
129
+ timezone: int = 8,
130
+ start_time: str = None,
131
+ end_time: str = None,
132
+ show_calendar_day: int = 2,
133
+ breakdowns: list = None,
134
+ metrics: list = None,
135
+ sort: str = None,
136
+ order: str = "DESC",
137
+ adv_campaign_id: int = None
138
+ ):
139
+ """
140
+ 获取广告单元列表
141
+ 需要登录:{'code': 400, 'msg': 'Please login first', 'data': None}
142
+ 验证成功:{'code': 200, 'msg': 'success', 'data': {}
143
+ :param start_time: 开始日期,例如:2025-03-05
144
+ :param end_time: 结束日期,例如:2025-03-05
145
+ :param breakdowns: 分组依据(高级选项):[]
146
+ (date:天, timestamp:小时,week:周,month:月)
147
+ adv_offer_id:广告单元,
148
+ bid_type:Bid Type,
149
+ country_code:国家或地区
150
+ app:应用id(子渠道)
151
+ package_name:包名(子渠道)
152
+ app_name:应用名称(子渠道)
153
+ adv_campaign_id:广告
154
+ received_price:单价
155
+ ad_type:广告类型
156
+ :param sort: [可选-排序] 排序依据(高级选项):adv_install:转化
157
+ :param adv_campaign_id: [可选-筛选]广告名称
158
+ """
159
+ scheme = "https"
160
+ host = "ss-api.mintegral.com"
161
+ filename = "/api/v1/reports/performance" # 获取详细数据
162
+ filename_total = "/api/v1/reports/performance-total" # 获取总数据数据量,该请求优先
163
+
164
+ if not start_time:
165
+ start_time = lazytime.get_date_string(days=0)
166
+ if not end_time:
167
+ end_time = lazytime.get_date_string(days=0)
168
+ if not breakdowns: # 数据维度
169
+ breakdowns = [
170
+ "date",
171
+ "adv_offer_id"
172
+ ]
173
+ if not metrics: # 数据指标
174
+ metrics = [
175
+ "adv_impression", # 展示
176
+ "adv_click", # 点击
177
+ "adv_install", # 转化
178
+ "ecpm", # eCPM
179
+ "ecpc", # CPC
180
+ "ecpi", # eCPI
181
+ "ctr", # CTR
182
+ "ivr", # IVR
183
+ "cvr", # CVR
184
+ "adv_original_money", # 花费
185
+ "iaa_d0_ad_revenue", # D0 Ad Rev
186
+ "iaa_d0_roas", # D0 Ad Roas
187
+ "iaa_d3_ad_revenue", # D3 Ad Rev
188
+ "iaa_d3_roas", # D3 Ad Roas
189
+ "iaa_d7_ad_revenue", # D7 Ad Rev
190
+ "iaa_d7_roas", # D7 Ad Roas
191
+ # "iap_d0_ad_revenue", # D0 IAP Rev
192
+ # "iap_d0_roas", # D0 IAP Roas
193
+ # "iap_d3_ad_revenue", # D3 IAP Rev
194
+ # "iap_d3_roas", # D3 IAP Roas
195
+ # "iap_d7_ad_revenue", # D7 IAP Rev
196
+ # "iap_d7_roas", # D7 IAP Roas
197
+ ]
198
+ params = {
199
+ "limit": page_size,
200
+ "page": page,
201
+ "timezone": timezone,
202
+ "start_time": start_time,
203
+ "end_time": end_time,
204
+ "order": order, # 排序
205
+ "breakdowns": ",".join(breakdowns),
206
+ "metrics": ",".join(metrics),
207
+ "show_calendar_day": show_calendar_day
208
+ }
209
+ if sort:
210
+ params["sort"] = sort
211
+ headers = copy.deepcopy(default_headers)
212
+ headers["Cookie"] = cookie
213
+ if total:
214
+ return lazyrequests.lazy_requests(
215
+ method="GET",
216
+ params=params,
217
+ url=f"{scheme}://{host}{filename_total}",
218
+ headers=headers
219
+ )
220
+ else:
221
+ return lazyrequests.lazy_requests(
222
+ method="GET",
223
+ params=params,
224
+ url=f"{scheme}://{host}{filename}",
225
+ headers=headers
226
+ )
lazyad/open/qq.py CHANGED
@@ -204,7 +204,7 @@ def get_advertiser_daily_budget(
204
204
 
205
205
  def update_daily_budget(
206
206
  access_token: str,
207
- account_id=None,
207
+ account_id: int = None,
208
208
  daily_budget: int = None,
209
209
  update_daily_budget_spec: list = None
210
210
  ):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.38
3
+ Version: 0.0.41
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -23,7 +23,17 @@ Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN
23
23
 
24
24
  #### 安装教程
25
25
 
26
- 1. xxxx
26
+ 1. 使用pip安装
27
+ - 普通方式安装
28
+ ```shell script
29
+ pip3 install lazyad
30
+ ```
31
+
32
+ - 使用阿里镜像加速安装
33
+ ```shell script
34
+ pip3 install lazyad -i https://mirrors.aliyun.com/pypi/simple
35
+ ```
36
+
27
37
  2. xxxx
28
38
  3. xxxx
29
39
 
@@ -1,11 +1,12 @@
1
1
  lazyad/__init__.py,sha256=tnVTFEgdzgMWQI0mZqy3DAueMJjpypPb15DdxJ-9TiU,41
2
2
  lazyad/crawlers/__init__.py,sha256=GK3GGpiUJbESc1uGTwSmEnsSUwYDNZfJCxeLYB4CpS4,68
3
3
  lazyad/crawlers/chuangliang.py,sha256=nU57GkUGAXcu8TquqB9hg8Ysvl5E3ZlGX6pedj_nIwo,24830
4
+ lazyad/crawlers/mintegral.py,sha256=8qmJAUdTPKpS2VYFSuTBC1VVBvSPyr_rrbwSuXQ0BJg,6745
4
5
  lazyad/crawlers/oceanengine.py,sha256=kjBEpCb_h5OpodCTqzvXd5MBBwAuw3Oq5UKWoTCXrQM,4540
5
6
  lazyad/crawlers/qq.py,sha256=X_VjdgzAcDfckEAHrvdqBLtnmAuCBHPJVWu2H-IHZBA,5649
6
7
  lazyad/open/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- lazyad/open/qq.py,sha256=FdRKY1cYINbSYgtUtDnW2iiyLACm6jUL84ghNg5ZQzw,6897
8
- lazyad-0.0.38.dist-info/METADATA,sha256=XxVhtEOkZZcVD_oDse16B0rZAQuckPHR1wdfV0XcPCA,1695
9
- lazyad-0.0.38.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
10
- lazyad-0.0.38.dist-info/top_level.txt,sha256=RAPjtj4gZYpsKAM3fAQrWyyn84xjdRuaiUS76gx6eNs,7
11
- lazyad-0.0.38.dist-info/RECORD,,
8
+ lazyad/open/qq.py,sha256=pru1p4LCjURD9N5ukx-OStYAmDCvrTW4VMB2N0-3i5Q,6904
9
+ lazyad-0.0.41.dist-info/METADATA,sha256=dACiaTJirotFAz-6vvlzaH0l1MLRgylQHGPsws99jio,1884
10
+ lazyad-0.0.41.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
11
+ lazyad-0.0.41.dist-info/top_level.txt,sha256=RAPjtj4gZYpsKAM3fAQrWyyn84xjdRuaiUS76gx6eNs,7
12
+ lazyad-0.0.41.dist-info/RECORD,,