sc-common-interface 2.6.9__tar.gz → 2.7.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.6.9 → sc_common_interface-2.7.1}/PKG-INFO +1 -1
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface/LiveCommonInterface.py +24 -45
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/setup.py +1 -1
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface/McCommonInterface.py +0 -0
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface/Platform.py +0 -0
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface/PostCommonInterface.py +0 -0
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface/__init__.py +0 -0
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/setup.cfg +0 -0
{sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -194,22 +194,12 @@ def end_activity(data):
|
|
|
194
194
|
def send__live_comment(data):
|
|
195
195
|
env = data["env"]
|
|
196
196
|
key = data["key"]
|
|
197
|
-
platform = "FACEBOOK"
|
|
198
|
-
page_id = ""
|
|
199
|
-
post_id = ""
|
|
200
|
-
group_id = ""
|
|
201
197
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
post_id = data['post_id']
|
|
208
|
-
if "group_id" in data:
|
|
209
|
-
post_id = data['group_id']
|
|
210
|
-
sales_type = "live"
|
|
211
|
-
if "sales_type" in data:
|
|
212
|
-
sales_type = data["sales_type"]
|
|
198
|
+
page_id = data.get("page_id", "")
|
|
199
|
+
platform = data.get("platform", "FACEBOOK")
|
|
200
|
+
post_id = data.get("post_id", "")
|
|
201
|
+
group_id = data.get("group_id", "")
|
|
202
|
+
sales_type = data.get("sales_type", "live")
|
|
213
203
|
if page_id == "" or post_id == "key":
|
|
214
204
|
info = get_live_info(data)
|
|
215
205
|
# print("info",info)
|
|
@@ -268,7 +258,7 @@ def send__live_comment(data):
|
|
|
268
258
|
if "-" in post_id:
|
|
269
259
|
post_id = post_id.split("_")[-1]
|
|
270
260
|
else:
|
|
271
|
-
print("----")
|
|
261
|
+
# print("----")
|
|
272
262
|
relationUrl = data["relationUrl"]
|
|
273
263
|
match = re.search(r'groups/(\d+)/posts/(\d+)/', relationUrl)
|
|
274
264
|
group_id = match.group(1)
|
|
@@ -278,14 +268,14 @@ def send__live_comment(data):
|
|
|
278
268
|
"from":{"id":user_id,"name":name},"group_id":group_id,"post_id":post_id,"comment_id":comment_id,"created_time":stamp,"item":"comment",
|
|
279
269
|
"verb":"add","parent_id":post_id,"field":"group_feed"}]}]}
|
|
280
270
|
|
|
281
|
-
print(body)
|
|
271
|
+
# print(body)
|
|
282
272
|
url = "%s/facebook/webhook" % env
|
|
283
273
|
sign_text = hmac.new(key.encode("utf-8"), json.dumps(body).encode("utf-8"), sha1)
|
|
284
274
|
signData = sign_text.hexdigest()
|
|
285
275
|
# print("body", json.dumps(body))
|
|
286
276
|
header = {"Content-Type": "application/json", "x-hub-signature": "sha1=%s" % signData}
|
|
287
277
|
response = requests.post(url, headers=header, data=json.dumps(body))
|
|
288
|
-
print(response.text)
|
|
278
|
+
# print(response.text)
|
|
289
279
|
return user_id, name, comment_id
|
|
290
280
|
|
|
291
281
|
def send_mc_message(data):
|
|
@@ -293,26 +283,15 @@ def send_mc_message(data):
|
|
|
293
283
|
key = data["key"]
|
|
294
284
|
stamp = int(time.time()*1000)
|
|
295
285
|
user_id = "488864%d" % int(time.time())
|
|
296
|
-
type = "commment"
|
|
297
|
-
payload = "{}"
|
|
298
|
-
if "payload" in data:
|
|
299
|
-
payload = data["payload"]
|
|
300
|
-
if "type" in data:
|
|
301
|
-
type = data["type"]
|
|
302
|
-
if "user_id" in data:
|
|
303
|
-
user_id = data['user_id']
|
|
304
286
|
name = "test live%d" % int(time.time())
|
|
305
|
-
if "name" in data:
|
|
306
|
-
name = data['name']
|
|
307
287
|
message = "接口测试普通留言"
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
platform = data['platform']
|
|
288
|
+
payload = data.get("payload","{}")
|
|
289
|
+
type = data.get("type", "commment")
|
|
290
|
+
user_id = data.get("user_id",user_id)
|
|
291
|
+
name = data.get("name", name)
|
|
292
|
+
message = data.get("message", message)
|
|
293
|
+
page_id = data.get("page_id", "")
|
|
294
|
+
platform = data.get("platform", "FACEBOOK")
|
|
316
295
|
if page_id=="":
|
|
317
296
|
info = get_live_info(data)
|
|
318
297
|
platform_list = jsonpath(info, "$..relatedPostList..platform")
|
|
@@ -331,7 +310,7 @@ def send_mc_message(data):
|
|
|
331
310
|
# body = {"entry":[{"id":"%s"%page_id,"messaging":[{"message":
|
|
332
311
|
# {"mid":"m_hhAqPhSlMTY4En2oWjSB59T3BFjeU97DdDV4WHr3DLWnPrO0iCsjQlG3hBN%d-sBlT26-6oNg"%stamp,"text":"%s"%message},
|
|
333
312
|
# "recipient":{"id":"%s"%page_id},"sender":{"id":"%s"%user_id},"timestamp":stamp}],"time":stamp}],"object":"page"}
|
|
334
|
-
if platform.upper()=="INSTAGRAM":
|
|
313
|
+
if type=="commment" and platform.upper()=="INSTAGRAM":
|
|
335
314
|
body={"object":"instagram","entry":[{"time":stamp,"id":"%s"%page_id,"messaging":[{"sender":{"id":"%s"%user_id},"recipient":{"id":"%s"%page_id},
|
|
336
315
|
"timestamp":stamp,"message":{"mid":"aWdfZAG1faXRlbToxOklHTWVzc2FnZAUlEOjE3ODQxNDUwMzgwODgwNTMzOjM0MDI4MjM2Njg0MTcxMDMwMTI0NDI3NjAyNDExMzcwMDc2NTA5MDozMTgzODU0Mzg3NTY4MDYwMTE3ODUxOTE2MD%d"%stamp,"text":"%s"%message}}]}]}
|
|
337
316
|
elif type=="postback" and platform.upper() in ("FB_GROUP","FACEBOOK"):
|
|
@@ -349,7 +328,7 @@ def send_mc_message(data):
|
|
|
349
328
|
header = {"Content-Type": "application/json", "x-hub-signature": "sha1=%s" % signData}
|
|
350
329
|
response = requests.post(url, headers=header, data=json.dumps(body))
|
|
351
330
|
# print(response.text)
|
|
352
|
-
print(body)
|
|
331
|
+
# print(body)
|
|
353
332
|
return user_id, name
|
|
354
333
|
|
|
355
334
|
|
|
@@ -370,7 +349,7 @@ def get_live_info(data):
|
|
|
370
349
|
else:
|
|
371
350
|
count=count+1
|
|
372
351
|
if count>10:
|
|
373
|
-
print("
|
|
352
|
+
print("查询报错:",response)
|
|
374
353
|
return response
|
|
375
354
|
|
|
376
355
|
|
|
@@ -460,7 +439,11 @@ def live_search_oa_product(data):
|
|
|
460
439
|
query = data["query"]
|
|
461
440
|
url = "%s/openApi/proxy/v1/products?page=1&per_page=4&query=%s" % (env,query)
|
|
462
441
|
response = requests.get(url, headers=headers).json()
|
|
463
|
-
|
|
442
|
+
global items
|
|
443
|
+
try:
|
|
444
|
+
items = response["data"]["items"]
|
|
445
|
+
except Exception:
|
|
446
|
+
print("response:", response)
|
|
464
447
|
variant_options_list = jsonpath(items,"$..variations")
|
|
465
448
|
product_info = ""
|
|
466
449
|
spu_id = ""
|
|
@@ -2000,11 +1983,7 @@ def add_all_product_set_to_keyword(data):
|
|
|
2000
1983
|
|
|
2001
1984
|
|
|
2002
1985
|
if __name__=="__main__":
|
|
2003
|
-
|
|
2004
|
-
data = {'env': 'https://front-admin-preview.shoplineapp.com', 'headers': {'Content-Type': 'application/json', 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkZmQxYjNiMDc0M2JmYWU4YTFkODk4NzczNjgyZWVkZCIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAiLCJhcHBsaWNhdGlvbl9pZCI6IjVlYjkwMzVhYjA5ZDEyNjU4NTFmOTU2ZiJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMtcHJldmlldy5zaG9wbGluZWFwcC5jb20iLCJhdWQiOltdLCJzdWIiOiI2MWE4N2M5NzYzYjcwYzAwNTEwNmZiZDAifQ.Y90xLfYVAp9yByHo7Vc7A3hHrp6hX9X9Lg4mg_WiE_I', 'lang': 'en'}, 'platform': 'FB_GROUP', 'sales_id': 542794, 'page_id': '106411048594439', 'relationUrl': 'https://www.facebook.com/groups/3592205981019493/posts/3871576623082426/', 'post_id': ['https://www.facebook.com/groups/3592205981019493/posts/3871576623082426/', 'https://www.facebook.com/groups/3592205981019493/posts/3871571433082945/', 'https://www.facebook.com/groups/3592205981019493/posts/3872673686306053/']}
|
|
2005
|
-
sales_id= create_live(data)
|
|
2006
|
-
data["sales_id"] = sales_id
|
|
2007
|
-
delete_relate_post(data)
|
|
1986
|
+
pass
|
|
2008
1987
|
|
|
2009
1988
|
|
|
2010
1989
|
|
{sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface/PostCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc_common_interface-2.6.9 → sc_common_interface-2.7.1}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|