smartpush 1.9.8__py3-none-any.whl → 2.0.0__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.
- smartpush/base/request_base.py +10 -2
- smartpush/base/url_enum.py +57 -38
- smartpush/crowd/crowd.py +155 -400
- smartpush/email/activity.py +66 -0
- smartpush/email/schema.py +179 -18
- smartpush/email/universal_content.py +50 -13
- smartpush/form/form_after.py +10 -10
- smartpush/test.py +0 -0
- smartpush/utils/ListDictUtils.py +53 -1
- smartpush/utils/date_utils.py +339 -0
- {smartpush-1.9.8.dist-info → smartpush-2.0.0.dist-info}/METADATA +1 -1
- {smartpush-1.9.8.dist-info → smartpush-2.0.0.dist-info}/RECORD +14 -11
- {smartpush-1.9.8.dist-info → smartpush-2.0.0.dist-info}/WHEEL +0 -0
- {smartpush-1.9.8.dist-info → smartpush-2.0.0.dist-info}/top_level.txt +0 -0
smartpush/base/request_base.py
CHANGED
|
@@ -41,21 +41,23 @@ class RequestBase:
|
|
|
41
41
|
}
|
|
42
42
|
response_json = None
|
|
43
43
|
default_kwargs.update(kwargs)
|
|
44
|
-
if default_kwargs.get('data') and isinstance(default_kwargs.get('data'), dict):
|
|
44
|
+
if default_kwargs.get('data') and isinstance(default_kwargs.get('data'), dict):
|
|
45
45
|
data = json.dumps(default_kwargs.get('data'))
|
|
46
46
|
default_kwargs.update({'data': data})
|
|
47
|
+
response = None
|
|
47
48
|
try:
|
|
48
49
|
print("请求参数为:\n", json.dumps(default_kwargs, ensure_ascii=False))
|
|
49
50
|
response = self.session.request(method, url, **default_kwargs)
|
|
50
51
|
response.raise_for_status()
|
|
51
52
|
response_json = response.json()
|
|
52
53
|
print("响应内容为:\n", json.dumps(response_json, ensure_ascii=False))
|
|
53
|
-
# assert response_json['code'] == 1
|
|
54
54
|
return response_json
|
|
55
55
|
except requests.exceptions.RequestException as e:
|
|
56
56
|
print(f"请求失败: {e}")
|
|
57
57
|
return None
|
|
58
58
|
except Exception as e:
|
|
59
|
+
print("响应:\n", response)
|
|
60
|
+
print("响应内容为:\n", json.dumps(response.json(), ensure_ascii=False))
|
|
59
61
|
raise e
|
|
60
62
|
|
|
61
63
|
|
|
@@ -69,3 +71,9 @@ class CrowdRequestBase(RequestBase):
|
|
|
69
71
|
def __init__(self, crowd_id, host, headers, **kwargs):
|
|
70
72
|
super().__init__(host, headers, **kwargs)
|
|
71
73
|
self.crowd_id = crowd_id
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ActivityTemplateRequestBase(RequestBase):
|
|
77
|
+
def __init__(self, activityTemplateId, host, headers, **kwargs):
|
|
78
|
+
super().__init__(host, headers, **kwargs)
|
|
79
|
+
self.activityTemplateId = activityTemplateId
|
smartpush/base/url_enum.py
CHANGED
|
@@ -1,54 +1,73 @@
|
|
|
1
1
|
from enum import Enum, unique
|
|
2
2
|
|
|
3
|
+
POST = 'POST'
|
|
4
|
+
GET = 'GET'
|
|
5
|
+
|
|
3
6
|
|
|
4
7
|
@unique
|
|
5
|
-
class
|
|
8
|
+
class BaseEnum(Enum):
|
|
9
|
+
@property
|
|
10
|
+
def method(self):
|
|
11
|
+
return self.value[1]
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def url(self):
|
|
15
|
+
return self.value[0]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class URL:
|
|
6
19
|
"""
|
|
7
20
|
GET的参数用params,
|
|
8
21
|
POST参数用data,
|
|
9
22
|
"""
|
|
10
23
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
class FormReport(BaseEnum):
|
|
25
|
+
"""
|
|
26
|
+
:type:表单报告
|
|
27
|
+
"""
|
|
28
|
+
pageFormReportDetail = '/formReport/detail/pageFormReportDetail', POST # 获取表单收集数据
|
|
29
|
+
getFormReportDetail = '/formReport/getFormReportDetail', POST # 获取表单报告数据(曝光/点击)
|
|
30
|
+
getFormPerformanceTrend = 'formReport/getFormPerformanceTrend', POST
|
|
17
31
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"""
|
|
27
|
-
:type 表单操作
|
|
28
|
-
"""
|
|
29
|
-
deleteForm = '/form/deleteFormInfo', 'GET'
|
|
30
|
-
getFormList = '/form/getFormList', 'POST'
|
|
31
|
-
getFormInfo = '/form/getFormInfo', 'GET'
|
|
32
|
+
class Crowd(BaseEnum):
|
|
33
|
+
"""
|
|
34
|
+
:type 群组
|
|
35
|
+
"""
|
|
36
|
+
editCrowdPackage = '/crowdPackage/editCrowdPackage', POST
|
|
37
|
+
crowdPersonListInPackage = '/crowdPackage/crowdPersonList', POST
|
|
38
|
+
crowdPackageDetail = '/crowdPackage/detail', POST
|
|
39
|
+
crowdPackageList = '/crowdPackage/list', POST
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
updateCampaignUsed = "/universalContent/updateCampaignUsed",'POST'
|
|
41
|
-
queryUsedDetail = "/universalContent/queryUsedDetail", 'POST'
|
|
41
|
+
class Form(BaseEnum):
|
|
42
|
+
"""
|
|
43
|
+
:type 表单操作
|
|
44
|
+
"""
|
|
45
|
+
deleteForm = '/form/deleteFormInfo', GET
|
|
46
|
+
getFormList = '/form/getFormList', POST
|
|
47
|
+
getFormInfo = '/form/getFormInfo', GET
|
|
42
48
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
class UniversalContent(BaseEnum):
|
|
50
|
+
"""
|
|
51
|
+
:type 素材收藏
|
|
52
|
+
"""
|
|
53
|
+
saveUniversalContent = "/universalContent/saveUniversalContent", POST
|
|
54
|
+
deleteUniversalContent = "/universalContent/deleteUniversalContent", GET
|
|
55
|
+
updateUniversalContent = "/universalContent/updateUniversalContent", POST
|
|
56
|
+
queryUniversalContent = "/universalContent/query", POST
|
|
57
|
+
updateCampaignUsed = "/universalContent/updateCampaignUsed", POST
|
|
58
|
+
queryUsedDetail = "/universalContent/queryUsedDetail", POST
|
|
46
59
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
class Activity(BaseEnum):
|
|
61
|
+
"""
|
|
62
|
+
:type 活动
|
|
63
|
+
"""
|
|
64
|
+
step1 = "/marketing/insertOrUpdateActivity/step1", POST
|
|
65
|
+
step2 = "/marketing/insertOrUpdateActivity/step2", POST
|
|
66
|
+
step2_get = "/marketing/activityDetail/step2", GET
|
|
50
67
|
|
|
51
68
|
|
|
52
69
|
if __name__ == '__main__':
|
|
53
|
-
print(URL.pageFormReportDetail.
|
|
54
|
-
print(URL.
|
|
70
|
+
print(URL.FormReport.pageFormReportDetail.url)
|
|
71
|
+
print(URL.FormReport.pageFormReportDetail.method)
|
|
72
|
+
print(BaseEnum.url)
|
|
73
|
+
# print(URL.getFormReportDetail.url)
|