smartpush 1.5.6__py3-none-any.whl → 1.5.8__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 +17 -5
- smartpush/base/url_enum.py +1 -0
- smartpush/crowd/__init__.py +0 -0
- smartpush/crowd/crowd.py +52 -0
- smartpush/form/form_after.py +5 -27
- {smartpush-1.5.6.dist-info → smartpush-1.5.8.dist-info}/METADATA +1 -1
- {smartpush-1.5.6.dist-info → smartpush-1.5.8.dist-info}/RECORD +9 -7
- {smartpush-1.5.6.dist-info → smartpush-1.5.8.dist-info}/WHEEL +0 -0
- {smartpush-1.5.6.dist-info → smartpush-1.5.8.dist-info}/top_level.txt +0 -0
smartpush/base/request_base.py
CHANGED
@@ -38,21 +38,33 @@ class RequestBase:
|
|
38
38
|
"timeout": 30,
|
39
39
|
"headers": self.headers
|
40
40
|
}
|
41
|
+
response_json = None
|
41
42
|
default_kwargs.update(kwargs)
|
42
|
-
if default_kwargs.get('data'):
|
43
|
+
if default_kwargs.get('data'): # 如果data有值json序列化
|
43
44
|
data = json.dumps(default_kwargs.get('data'))
|
44
45
|
default_kwargs.update({'data': data})
|
45
46
|
try:
|
46
47
|
response = self.session.request(method, url, **default_kwargs)
|
47
48
|
response.raise_for_status()
|
48
|
-
|
49
|
-
|
49
|
+
response_json = response.json()
|
50
|
+
print("响应内容为:\n", json.dumps(response_json))
|
51
|
+
assert response_json['code'] == 1
|
52
|
+
return response_json
|
50
53
|
except requests.exceptions.RequestException as e:
|
51
54
|
print(f"请求失败: {e}")
|
52
55
|
return None
|
56
|
+
except Exception as e:
|
57
|
+
print("响应内容为:\n", json.dumps(response_json))
|
58
|
+
raise e
|
53
59
|
|
54
60
|
|
55
61
|
class FormRequestBase(RequestBase):
|
56
|
-
def __init__(self, form_id, host, headers):
|
57
|
-
super().__init__(host, headers)
|
62
|
+
def __init__(self, form_id, host, headers, **kwargs):
|
63
|
+
super().__init__(host, headers, **kwargs)
|
58
64
|
self.form_id = form_id
|
65
|
+
|
66
|
+
|
67
|
+
class CrowdRequestBase(RequestBase):
|
68
|
+
def __init__(self, crowd_id, host, headers, **kwargs):
|
69
|
+
super().__init__(host, headers, **kwargs)
|
70
|
+
self.crowd_id = crowd_id
|
smartpush/base/url_enum.py
CHANGED
File without changes
|
smartpush/crowd/crowd.py
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
from smartpush.base.request_base import CrowdRequestBase
|
2
|
+
from smartpush.base.url_enum import URL
|
3
|
+
|
4
|
+
|
5
|
+
class Crowd(CrowdRequestBase):
|
6
|
+
|
7
|
+
def callEditCrowdPackage(self, crowdName="", groupRules=None, groupRelation="$AND",
|
8
|
+
triggerStock=False):
|
9
|
+
"""
|
10
|
+
更新群组条件id
|
11
|
+
:param triggerStock:
|
12
|
+
:param crowdName:
|
13
|
+
:param groupRules:
|
14
|
+
:param groupRelation:
|
15
|
+
:return:
|
16
|
+
"""
|
17
|
+
requestParam = {"id": self.crowd_id, "crowdName": crowdName, "groupRelation": groupRelation,
|
18
|
+
"groupRules": groupRules, "triggerStock": triggerStock}
|
19
|
+
result = self.request(method=URL.editCrowdPackage.method, path=URL.editCrowdPackage.url, data=requestParam)
|
20
|
+
return result['resultData']
|
21
|
+
|
22
|
+
def callCrowdPersonList(self, page=1, pageSize=20, filter_type=None, filter_value=None):
|
23
|
+
"""
|
24
|
+
获取群组联系人列表
|
25
|
+
:param page:
|
26
|
+
:param pageSize:
|
27
|
+
:param filter_type:
|
28
|
+
:param filter_value:
|
29
|
+
:return:
|
30
|
+
"""
|
31
|
+
requestParam = {"id": self.crowd_id, "page": page, "pageSize": pageSize}
|
32
|
+
if filter_value is not None:
|
33
|
+
requestParam["filter"] = {filter_type: {"in": filter_value}}
|
34
|
+
result = self.request(method=URL.crowdPersonList.method, path=URL.crowdPersonList.url, data=requestParam)
|
35
|
+
resultData = result['resultData']
|
36
|
+
return resultData
|
37
|
+
|
38
|
+
def callCrowdPackageDetail(self, page=1, pageSize=20, filter_type=None, filter_value=None):
|
39
|
+
"""
|
40
|
+
获取群组详情
|
41
|
+
:param page:
|
42
|
+
:param pageSize:
|
43
|
+
:param filter_type:
|
44
|
+
:param filter_value:
|
45
|
+
:return:
|
46
|
+
"""
|
47
|
+
requestParam = {"id": self.crowd_id, "page": page, "pageSize": pageSize, "filter": {}}
|
48
|
+
if filter_value is not None:
|
49
|
+
requestParam["filter"] = {filter_type: {"in": filter_value}}
|
50
|
+
result = self.request(method=URL.crowdPersonList.method, path=URL.crowdPackageDetail.url, data=requestParam)
|
51
|
+
resultData = result['resultData']
|
52
|
+
return resultData
|
smartpush/form/form_after.py
CHANGED
@@ -2,6 +2,7 @@ import json
|
|
2
2
|
from tenacity import retry, stop_after_attempt, wait_fixed
|
3
3
|
from smartpush.base.request_base import FormRequestBase
|
4
4
|
from smartpush.base.url_enum import URL
|
5
|
+
from smartpush.crowd import crowd
|
5
6
|
from smartpush.export.basic.GetOssUrl import log_attempt
|
6
7
|
|
7
8
|
|
@@ -26,7 +27,6 @@ class FormAfter(FormRequestBase):
|
|
26
27
|
persons_list = result["resultData"]["reportDetailData"]["datas"]
|
27
28
|
return persons_list
|
28
29
|
|
29
|
-
|
30
30
|
def callGetFormReportDetail(self):
|
31
31
|
requestParam = {"formId": self.form_id}
|
32
32
|
result = self.request(method=URL.getFormReportDetail.method, path=URL.getFormReportDetail.url,
|
@@ -41,30 +41,6 @@ class FormAfter(FormRequestBase):
|
|
41
41
|
resultData = result["resultData"]
|
42
42
|
return resultData
|
43
43
|
|
44
|
-
def callEditCrowdPackage(self, _id=None, groupRules=None, groupRelation="$AND"):
|
45
|
-
"""
|
46
|
-
更新群组条件id
|
47
|
-
:param _id:
|
48
|
-
:param groupRules:
|
49
|
-
:param groupRelation:
|
50
|
-
:return:
|
51
|
-
"""
|
52
|
-
requestParam = {"id": _id, "crowdName": "表单查询群组-自动化", "groupRelation": groupRelation,
|
53
|
-
"groupRules": groupRules, "triggerStock": False}
|
54
|
-
result = self.request(method=URL.editCrowdPackage.method, path=URL.editCrowdPackage.url, data=requestParam)
|
55
|
-
assert result.get("code") == 1
|
56
|
-
resultData = result["resultData"]
|
57
|
-
assert resultData.get("status") == 2
|
58
|
-
return resultData["id"]
|
59
|
-
|
60
|
-
def callCrowdPersonList(self, _id, page, pageSize, filter_type, filter_value):
|
61
|
-
requestParam = {"id": _id, "page": page, "pageSize": pageSize}
|
62
|
-
if filter_value is not None:
|
63
|
-
requestParam["filter"] = {filter_type: {"in": filter_value}}
|
64
|
-
result = self.request(method=URL.crowdPersonList.method, path=URL.crowdPersonList.url, data=requestParam)
|
65
|
-
result.raise_for_status()
|
66
|
-
return result['resultData']
|
67
|
-
|
68
44
|
def callGetFormList(self, formName):
|
69
45
|
requestParam = {'page': 1, 'pageSize': 10, 'name': formName}
|
70
46
|
result = self.request(method=URL.getFormList.method, path=URL.getFormList.url, data=requestParam)
|
@@ -77,7 +53,7 @@ class FormAfter(FormRequestBase):
|
|
77
53
|
|
78
54
|
def callDeleteForm(self, merchant_id):
|
79
55
|
requestParam = {"formId": self.form_id, "merchant_id": merchant_id}
|
80
|
-
result = self.request(method=URL.deleteForm.method,
|
56
|
+
result = self.request(method=URL.deleteForm.method, path=URL.deleteForm.url, params=requestParam)
|
81
57
|
assert result['code'] == 1
|
82
58
|
print(f"删除id:{self.form_id}表单成功")
|
83
59
|
|
@@ -153,6 +129,7 @@ class FormAfter(FormRequestBase):
|
|
153
129
|
def getCrowdPersonList(self, _id, page=1, pageSize=20, filter_type="email", filter_value=""):
|
154
130
|
self.callCrowdPersonList(self, _id, page, pageSize, filter_type, filter_value)
|
155
131
|
|
132
|
+
|
156
133
|
if __name__ == '__main__':
|
157
134
|
heard = {
|
158
135
|
'cookie': 'osudb_appid=SMARTPUSH;osudb_oar=#01#SID0000130BNXOsK5n5eE9jRh/qvw4GkPUL+3WXTwjU1L8VyW4x8OsSN2Z2/Dt4aoaLuvY8+7q9DWFuwOYuZEvYlUl28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tbWFya2V0IiwiY29va2llIiwic2wtZWNvbS1lbWFpbC1tYXJrZXQtbmV3LXRlc3QiLCJlbWFpbC1tYXJrZXQtbmV3LWRldi1mcyIsImFwaS11Yy1lYzIiLCJhcGktc3UtZWMyIiwiYXBpLWVtLWVjMiIsImZsb3ctcGx1Z2luIiwiYXBpLXNwLW1hcmtldC1lYzIiXSwiY2xpZW50X2lkIjoiZW1haWwtbWFya2V0In0.T9u3uzrxEulBSMWB-mqkyxEsu6tB-7FVqt9nBhkxPAo;',
|
@@ -160,4 +137,5 @@ if __name__ == '__main__':
|
|
160
137
|
'Content-Type': 'application/json'}
|
161
138
|
host = 'https://test.smartpushedm.com/bff/api-em-ec2'
|
162
139
|
after = FormAfter(form_id=19238, headers=heard, host=host)
|
163
|
-
|
140
|
+
after.callDeleteForm('1644395920444')
|
141
|
+
# print(after.callGetFormInfo())
|
@@ -4,8 +4,10 @@ smartpush/account/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
4
4
|
smartpush/account/operate_account.py,sha256=nzJLLAEwNElavZeWVqnA_MSGTBzQrSrknmezYBwtvWs,1525
|
5
5
|
smartpush/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
smartpush/base/faker_data.py,sha256=TOd5EKVImxZpsKEW_dtKa2iqiUGqU7OBkOM8pvqKVUc,24643
|
7
|
-
smartpush/base/request_base.py,sha256=
|
8
|
-
smartpush/base/url_enum.py,sha256=
|
7
|
+
smartpush/base/request_base.py,sha256=PpWVYQEBQN6FZtXJNDGx29qPsRKN7o_299HfK_Vr1jE,2297
|
8
|
+
smartpush/base/url_enum.py,sha256=PmU44Qj3yvHZPYovx5F8DQ7FQRMjq9Tw0JHV7kHpXM0,1020
|
9
|
+
smartpush/crowd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
+
smartpush/crowd/crowd.py,sha256=x1a-2LSbKx8GZhmJ8hkY9csMa9W6khOr40dflSvEJYU,2088
|
9
11
|
smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
|
10
12
|
smartpush/export/basic/ExcelExportChecker.py,sha256=3IAeu1kjFS4MpDxjVB1htAcRA1BtfpH3xEkZyP4htAA,19963
|
11
13
|
smartpush/export/basic/GetOssUrl.py,sha256=LeF1y1_uJaYXth1KvO6mEDS29ezb9tliBv5SrbqYkXc,6136
|
@@ -14,7 +16,7 @@ smartpush/export/basic/__init__.py,sha256=6tcrS-2NSlsJo-UwEsnGUmwCf7jgOsh_UEbM0F
|
|
14
16
|
smartpush/flow/MockFlow.py,sha256=MI8WIMZyKlxrV5QVs8rXX6iD07Ldl37_L5Yb5FWqHzU,8595
|
15
17
|
smartpush/flow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
18
|
smartpush/form/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
-
smartpush/form/form_after.py,sha256=
|
19
|
+
smartpush/form/form_after.py,sha256=VzBRDCzUmrgdSQu_Mr2ccbqkQvVCr71vei2utmvPbwI,8334
|
18
20
|
smartpush/form/form_assert.py,sha256=wPIRfQHhr7lN1fFd-mp0z_qKMtF4jfrNxRWvp2xfqCg,257
|
19
21
|
smartpush/form/form_before.py,sha256=CCvAC_2yWPlnQGtjEA8LPLy9853Nq3nNjcL2GewFWIs,175
|
20
22
|
smartpush/form/form_client_operation.py,sha256=gg-5uHXCyMa_ypBSYPYFVxXdwZdYBJsNtUCqayknMBw,303
|
@@ -24,7 +26,7 @@ smartpush/utils/ListDictUtils.py,sha256=Fm5_d7UyY6xB8gySMPdl5jIFSRhXZcYXdYW-_L1a
|
|
24
26
|
smartpush/utils/StringUtils.py,sha256=n8mo9k0JQN63MReImgv-66JxmmymOGknR8pH2fkQrAo,4139
|
25
27
|
smartpush/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
28
|
smartpush/utils/form_utils.py,sha256=ld-g_Dm_ZlnagQt7imYfUc87bcBRVlTctywuLtzmjXQ,849
|
27
|
-
smartpush-1.5.
|
28
|
-
smartpush-1.5.
|
29
|
-
smartpush-1.5.
|
30
|
-
smartpush-1.5.
|
29
|
+
smartpush-1.5.8.dist-info/METADATA,sha256=ka9ntRxvwReN7Fgq1j69QX8_An4XFlw2Pon8G6RQYFg,131
|
30
|
+
smartpush-1.5.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
31
|
+
smartpush-1.5.8.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
32
|
+
smartpush-1.5.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|