sc-common-interface 2.7.3__tar.gz → 2.7.5__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.7.3 → sc_common_interface-2.7.5}/PKG-INFO +1 -1
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface/LiveCommonInterface.py +23 -15
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/setup.py +1 -1
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface/McCommonInterface.py +0 -0
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface/Platform.py +0 -0
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface/PostCommonInterface.py +0 -0
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface/__init__.py +0 -0
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/setup.cfg +0 -0
{sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -24,9 +24,7 @@ def delete_relate_post(data):
|
|
|
24
24
|
env = data["env"]
|
|
25
25
|
headers = data["headers"]
|
|
26
26
|
url = "%s/api/posts/post/sales" % env
|
|
27
|
-
sales_type = "LIVE"
|
|
28
|
-
if "sales_type" in data:
|
|
29
|
-
sales_type = data["sales_type"]
|
|
27
|
+
sales_type = data.get("sales_type","LIVE")
|
|
30
28
|
param = {"page_num": 1, "page_size": 100, "sales_type": sales_type}
|
|
31
29
|
platform = "facebook"
|
|
32
30
|
post_id = data["post_id"]
|
|
@@ -202,10 +200,13 @@ def get_page_info(data):
|
|
|
202
200
|
platform = info["data"]["relatedPostList"][i]["platform"]
|
|
203
201
|
post_id = info["data"]["relatedPostList"][i]["post_id"]
|
|
204
202
|
group_id = info["data"]["relatedPostList"][i]["group_id"]
|
|
203
|
+
permalink_url = info["data"]["relatedPostList"][i]["permalink_url"]
|
|
205
204
|
page_info["page_id"] = page_id
|
|
206
205
|
page_info["platform"] = platform
|
|
207
206
|
page_info["post_id"] = post_id
|
|
208
207
|
page_info["group_id"] = group_id
|
|
208
|
+
page_info["permalink_url"] = permalink_url
|
|
209
|
+
|
|
209
210
|
elif sales_type.lower() == "post":
|
|
210
211
|
platform_list = jsonpath(info, "$..related_post_list..platform")
|
|
211
212
|
i = platform_list.index(platform.upper())
|
|
@@ -213,10 +214,12 @@ def get_page_info(data):
|
|
|
213
214
|
platform = info["data"]["related_post_list"][i]["platform"]
|
|
214
215
|
post_id = info["data"]["related_post_list"][i]["post_id"]
|
|
215
216
|
group_id = info["data"]["related_post_list"][i]["group_id"]
|
|
217
|
+
permalink_url = info["data"]["related_post_list"][i]["permalink_url"]
|
|
216
218
|
page_info["page_id"] = page_id
|
|
217
219
|
page_info["platform"] = platform
|
|
218
220
|
page_info["post_id"] = post_id
|
|
219
221
|
page_info["group_id"] = group_id
|
|
222
|
+
page_info["permalink_url"] = permalink_url
|
|
220
223
|
return page_info
|
|
221
224
|
|
|
222
225
|
|
|
@@ -227,22 +230,25 @@ def send__live_comment(data):
|
|
|
227
230
|
platform = data.get("platform", "FACEBOOK")
|
|
228
231
|
post_id = data.get("post_id", "")
|
|
229
232
|
group_id = data.get("group_id", "")
|
|
230
|
-
# sales_type = data.get("sales_type", "live")
|
|
231
|
-
if page_id == "" or post_id == "key":
|
|
232
|
-
page_info = get_page_info(data)
|
|
233
|
-
platform = page_info["platform"]
|
|
234
|
-
post_id = page_info["post_id"]
|
|
235
|
-
group_id = page_info["group_id"]
|
|
236
233
|
stamp = int(time.time())
|
|
237
234
|
num = random.randint(100000, 999999)
|
|
238
235
|
user_id = "488864%d" % int(time.time())
|
|
239
236
|
name = "test live%d" % int(time.time())
|
|
240
237
|
comment_id = "%s_%d%d" % (page_id, stamp, num)
|
|
241
238
|
keyword = "接口测试普通留言"
|
|
242
|
-
user_id = data.get("user_id",user_id)
|
|
239
|
+
user_id = data.get("user_id", user_id)
|
|
243
240
|
name = data.get("name", name)
|
|
244
241
|
comment_id = data.get("comment_id", comment_id)
|
|
245
242
|
keyword = data.get("keyword", keyword)
|
|
243
|
+
# sales_type = data.get("sales_type", "live")
|
|
244
|
+
relationUrl = data.get("relationUrl")
|
|
245
|
+
if page_id == "" or post_id == "key":
|
|
246
|
+
page_info = get_page_info(data)
|
|
247
|
+
platform = page_info["platform"]
|
|
248
|
+
post_id = page_info["post_id"]
|
|
249
|
+
group_id = page_info["group_id"]
|
|
250
|
+
relationUrl = page_info["permalink_url"]
|
|
251
|
+
|
|
246
252
|
|
|
247
253
|
body = {"object": "page", "entry": [{"id": page_id, "time": stamp, "changes": [{"field": "feed", "value": {
|
|
248
254
|
"from": {"id": user_id, "name": name},
|
|
@@ -261,12 +267,12 @@ def send__live_comment(data):
|
|
|
261
267
|
"field": "comments"}]}], "object": "instagram"}
|
|
262
268
|
elif platform.upper() == "FB_GROUP":
|
|
263
269
|
t_time = stamp*1000
|
|
264
|
-
if "
|
|
270
|
+
if "_" in post_id:
|
|
265
271
|
post_id = post_id.split("_")[-1]
|
|
266
272
|
else:
|
|
267
273
|
# print("----")
|
|
268
|
-
relationUrl = data["relationUrl"]
|
|
269
|
-
match = re.search(r'groups/(\d+)/
|
|
274
|
+
# relationUrl = data["relationUrl"]
|
|
275
|
+
match = re.search(r'groups/(\d+)/permalink/(\d+)/', relationUrl)
|
|
270
276
|
group_id = match.group(1)
|
|
271
277
|
post_id = match.group(2)
|
|
272
278
|
comment_id = "%d%d" % ( stamp, num)
|
|
@@ -274,7 +280,7 @@ def send__live_comment(data):
|
|
|
274
280
|
"from":{"id":user_id,"name":name},"group_id":group_id,"post_id":post_id,"comment_id":comment_id,"created_time":stamp,"item":"comment",
|
|
275
281
|
"verb":"add","parent_id":post_id,"field":"group_feed"}]}]}
|
|
276
282
|
|
|
277
|
-
|
|
283
|
+
print(body)
|
|
278
284
|
url = "%s/facebook/webhook" % env
|
|
279
285
|
sign_text = hmac.new(key.encode("utf-8"), json.dumps(body).encode("utf-8"), sha1)
|
|
280
286
|
signData = sign_text.hexdigest()
|
|
@@ -300,6 +306,7 @@ def send_mc_message(data):
|
|
|
300
306
|
platform = data.get("platform", "FACEBOOK")
|
|
301
307
|
if page_id=="":
|
|
302
308
|
page_info = get_page_info(data)
|
|
309
|
+
page_id = page_info["page_id"]
|
|
303
310
|
platform = page_info["platform"]
|
|
304
311
|
post_id = page_info["post_id"]
|
|
305
312
|
group_id = page_info["group_id"]
|
|
@@ -352,10 +359,11 @@ def get_live_info(data):
|
|
|
352
359
|
if response.status_code==200:
|
|
353
360
|
return response.json()
|
|
354
361
|
else:
|
|
362
|
+
time.sleep(1)
|
|
355
363
|
count=count+1
|
|
356
364
|
if count>10:
|
|
357
365
|
print("查询报错:",response)
|
|
358
|
-
return response
|
|
366
|
+
return response.content
|
|
359
367
|
|
|
360
368
|
|
|
361
369
|
|
{sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface/McCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface/PostCommonInterface.py
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc_common_interface-2.7.3 → sc_common_interface-2.7.5}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|