lazyad 0.0.45__tar.gz → 0.0.47__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.
- {lazyad-0.0.45 → lazyad-0.0.47}/PKG-INFO +1 -1
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad/crawlers/mintegral.py +25 -5
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad.egg-info/PKG-INFO +1 -1
- {lazyad-0.0.45 → lazyad-0.0.47}/setup.py +1 -1
- {lazyad-0.0.45 → lazyad-0.0.47}/README.md +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad/__init__.py +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad/crawlers/__init__.py +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad/crawlers/chuangliang.py +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad/crawlers/oceanengine.py +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad/crawlers/qq.py +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad/open/__init__.py +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad/open/mintegral.py +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad/open/qq.py +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad.egg-info/SOURCES.txt +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad.egg-info/dependency_links.txt +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad.egg-info/requires.txt +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/lazyad.egg-info/top_level.txt +0 -0
- {lazyad-0.0.45 → lazyad-0.0.47}/setup.cfg +0 -0
|
@@ -140,7 +140,8 @@ def performance(
|
|
|
140
140
|
order: str = "DESC",
|
|
141
141
|
adv_campaign_id: int = None,
|
|
142
142
|
promote_country_code: str = None,
|
|
143
|
-
timeout: int = default_timeout
|
|
143
|
+
timeout: int = default_timeout,
|
|
144
|
+
stream: bool = False
|
|
144
145
|
):
|
|
145
146
|
"""
|
|
146
147
|
获取广告单元列表
|
|
@@ -194,6 +195,7 @@ def performance(
|
|
|
194
195
|
:param adv_campaign_id: [可选-筛选]广告名称
|
|
195
196
|
:param promote_country_code: [可选-筛选]投放区域
|
|
196
197
|
:param timeout: 超时时间
|
|
198
|
+
:param stream: 为True时为流式下载
|
|
197
199
|
"""
|
|
198
200
|
scheme = "https"
|
|
199
201
|
host = "ss-api.mintegral.com"
|
|
@@ -252,15 +254,15 @@ def performance(
|
|
|
252
254
|
)
|
|
253
255
|
elif export:
|
|
254
256
|
params["t"] = int(time.time()*1000)
|
|
255
|
-
|
|
257
|
+
return lazyrequests.lazy_requests(
|
|
256
258
|
method="GET",
|
|
257
259
|
params=params,
|
|
258
260
|
url=f"{scheme}://{host}{filename_export}",
|
|
259
261
|
headers=headers,
|
|
260
262
|
timeout=timeout,
|
|
261
|
-
return_json=False
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
return_json=False,
|
|
264
|
+
stream=stream
|
|
265
|
+
) # 直接返回,由接收数据端自行处理
|
|
264
266
|
else:
|
|
265
267
|
return lazyrequests.lazy_requests(
|
|
266
268
|
method="GET",
|
|
@@ -270,6 +272,24 @@ def performance(
|
|
|
270
272
|
timeout=timeout
|
|
271
273
|
)
|
|
272
274
|
|
|
275
|
+
def sanitize_entities(
|
|
276
|
+
xml_content
|
|
277
|
+
):
|
|
278
|
+
"""
|
|
279
|
+
将非XML预定义实体全部替换
|
|
280
|
+
"""
|
|
281
|
+
import re
|
|
282
|
+
# 匹配非XML预定义实体
|
|
283
|
+
from html.entities import entitydefs
|
|
284
|
+
combined_map = {f'&{k};': v for k, v in entitydefs.items()}
|
|
285
|
+
pattern = re.compile(r'&(?!lt;|gt;|amp;|apos;|quot;)\w+;')
|
|
286
|
+
|
|
287
|
+
def replace_entity(match):
|
|
288
|
+
entity = match.group(0)
|
|
289
|
+
return combined_map.get(entity, entity) # 未定义则保持原样
|
|
290
|
+
|
|
291
|
+
return pattern.sub(replace_entity, xml_content)
|
|
292
|
+
|
|
273
293
|
|
|
274
294
|
def xml_to_dict(xml_str):
|
|
275
295
|
"""
|
|
@@ -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.
|
|
16
|
+
version="0.0.47",
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|