sc-common-interface 2.2.9__tar.gz → 2.3.1__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.
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/PKG-INFO +1 -1
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface/LiveCommonInterface.py +99 -7
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/setup.py +1 -1
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface/Platform.py +0 -0
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface/PostCommonInterface.py +0 -0
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface/__init__.py +0 -0
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/setup.cfg +0 -0
{sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -19,6 +19,7 @@ def create_activity(data):
|
|
|
19
19
|
if "platform" in data:
|
|
20
20
|
platform = data["platform"].upper()
|
|
21
21
|
response = requests.post(url,headers=headers,json=body)
|
|
22
|
+
print(response.json())
|
|
22
23
|
if response.status_code==200:
|
|
23
24
|
activity_id = response.json()["data"]
|
|
24
25
|
return activity_id
|
|
@@ -96,6 +97,47 @@ def send__live_comment(data):
|
|
|
96
97
|
response = requests.post(url, headers=header, data=json.dumps(body))
|
|
97
98
|
return user_id, name, comment_id
|
|
98
99
|
|
|
100
|
+
def send_mc_message(data):
|
|
101
|
+
env = data["env"]
|
|
102
|
+
key = data["key"]
|
|
103
|
+
stamp = int(time.time()*1000)
|
|
104
|
+
user_id = "488864%d" % int(time.time())
|
|
105
|
+
if "user_id" in data:
|
|
106
|
+
user_id = data['user_id']
|
|
107
|
+
name = "test live%d" % int(time.time())
|
|
108
|
+
if "name" in data:
|
|
109
|
+
name = data['name']
|
|
110
|
+
message = "接口测试普通留言"
|
|
111
|
+
if "message" in data:
|
|
112
|
+
message = data['message']
|
|
113
|
+
page_id = ""
|
|
114
|
+
if "page_id" in data:
|
|
115
|
+
page_id = data['page_id']
|
|
116
|
+
platform = "FACEBOOK"
|
|
117
|
+
if "platform" in data:
|
|
118
|
+
platform = data['platform']
|
|
119
|
+
if page_id=="":
|
|
120
|
+
info = get_live_info(data)
|
|
121
|
+
platform_list = jsonpath(info, "$..relatedPostList..platform")
|
|
122
|
+
i = platform_list.index(platform)
|
|
123
|
+
page_id = info["data"]["relatedPostList"][i]["page_id"]
|
|
124
|
+
platform = info["data"]["relatedPostList"][i]["platform"]
|
|
125
|
+
body = {}
|
|
126
|
+
if platform.upper()=="FACEBOOK":
|
|
127
|
+
body = {"entry":[{"id":"%s"%page_id,"messaging":[{"message":
|
|
128
|
+
{"mid":"m_hhAqPhSlMTY4En2oWjSB59T3BFjeU97DdDV4WHr3DLWnPrO0iCsjQlG3hBN%d-sBlT26-6oNg"%stamp,"text":"%s"%message},
|
|
129
|
+
"recipient":{"id":"%s"%page_id},"sender":{"id":"%s"%user_id},"timestamp":stamp}],"time":stamp}],"object":"page"}
|
|
130
|
+
elif platform.upper()=="INSTAGRAM":
|
|
131
|
+
body={"object":"instagram","entry":[{"time":stamp,"id":"%s"%page_id,"messaging":[{"sender":{"id":"%s"%user_id},"recipient":{"id":"%s"%page_id},
|
|
132
|
+
"timestamp":stamp,"message":{"mid":"aWdfZAG1faXRlbToxOklHTWVzc2FnZAUlEOjE3ODQxNDUwMzgwODgwNTMzOjM0MDI4MjM2Njg0MTcxMDMwMTI0NDI3NjAyNDExMzcwMDc2NTA5MDozMTgzODU0Mzg3NTY4MDYwMTE3ODUxOTE2MD%d"%stamp,"text":"%s"%message}}]}]}
|
|
133
|
+
url = "%s/facebook/webhook" % env
|
|
134
|
+
sign_text = hmac.new(key.encode("utf-8"), json.dumps(body).encode("utf-8"), sha1)
|
|
135
|
+
signData = sign_text.hexdigest()
|
|
136
|
+
header = {"Content-Type": "application/json", "x-hub-signature": "sha1=%s" % signData}
|
|
137
|
+
response = requests.post(url, headers=header, data=json.dumps(body))
|
|
138
|
+
return user_id, name
|
|
139
|
+
|
|
140
|
+
|
|
99
141
|
|
|
100
142
|
def get_live_info(data):
|
|
101
143
|
env = data["env"]
|
|
@@ -249,14 +291,64 @@ def get_merchant_info(data):
|
|
|
249
291
|
currency = "₫"
|
|
250
292
|
return base_country_code,currency,response
|
|
251
293
|
|
|
294
|
+
def delete_broadcast(data):
|
|
295
|
+
env = data["env"]
|
|
296
|
+
headers = data["headers"]
|
|
297
|
+
broadcast_id = data["broadcast_id"]
|
|
298
|
+
url = "%s/admin/api/bff-web/live/broadcast/%s"%(env,broadcast_id)
|
|
299
|
+
response = requests.delete(url,headers=headers).json()
|
|
300
|
+
return response
|
|
301
|
+
|
|
302
|
+
def get_broadcast_list(data):
|
|
303
|
+
env = data["env"]
|
|
304
|
+
headers = data["headers"]
|
|
305
|
+
sales_id = data["sales_id"]
|
|
306
|
+
name = ""
|
|
307
|
+
platform= data["platform"]
|
|
308
|
+
broadcast_id = ""
|
|
309
|
+
pageNum = 1
|
|
310
|
+
pageSize = 12
|
|
311
|
+
if "pageNum" in data:
|
|
312
|
+
pageNum = data["pageNum"]
|
|
313
|
+
if "pageSize" in data:
|
|
314
|
+
pageSize = data["pageSize"]
|
|
315
|
+
if "name" in data:
|
|
316
|
+
name= data["name"]
|
|
317
|
+
url = "%s/admin/api/bff-web/live/broadcast/query"%env
|
|
318
|
+
body = {
|
|
319
|
+
"businessId": "%s"%sales_id,
|
|
320
|
+
"businessType": "LIVE",
|
|
321
|
+
"businessSubType": "LIVE_STREAM",
|
|
322
|
+
"platform": "%s"%platform,
|
|
323
|
+
"pageNum": pageNum,
|
|
324
|
+
"pageSize": pageSize
|
|
325
|
+
}
|
|
326
|
+
reponse = requests.post(url,headers=headers,json=body).json()
|
|
327
|
+
if name !="":
|
|
328
|
+
name_list = jsonpath(reponse,"$..name")
|
|
329
|
+
broadcast_id_list = jsonpath(reponse,"$..id")
|
|
330
|
+
for i,value in enumerate(name_list):
|
|
331
|
+
if value==name:
|
|
332
|
+
broadcast_id =broadcast_id_list[i]
|
|
333
|
+
return broadcast_id,name
|
|
334
|
+
|
|
335
|
+
def get_broadcast_detail(data):
|
|
336
|
+
env = data["env"]
|
|
337
|
+
headers = data["headers"]
|
|
338
|
+
broadcast_id = data["broadcast_id"]
|
|
339
|
+
platform = data["platform"]
|
|
340
|
+
url = "%s/admin/api/bff-web/live/broadcast/detail"%env
|
|
341
|
+
body = {
|
|
342
|
+
"id": "%s"%broadcast_id,
|
|
343
|
+
"platform": "%s"%platform
|
|
344
|
+
}
|
|
345
|
+
response = requests.post(url,headers=headers,json=body).json()
|
|
346
|
+
return response
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
252
350
|
|
|
253
351
|
|
|
254
352
|
|
|
255
353
|
if __name__=="__main__":
|
|
256
|
-
|
|
257
|
-
# data["type"] = "sku"
|
|
258
|
-
# data['quantity'] = 0
|
|
259
|
-
# spu_id,sku_id,sku_id_quantity,product_info = live_search_oa_product(data)
|
|
260
|
-
# print(spu_id)
|
|
261
|
-
# print(sku_id)
|
|
262
|
-
# print(sku_id_quantity)
|
|
354
|
+
pass
|
|
File without changes
|
{sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface/PostCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc-common-interface-2.2.9 → sc-common-interface-2.3.1}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|