sc-common-interface 2.3.6__tar.gz → 2.3.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.3.6
3
+ Version: 2.3.7
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -56,19 +56,23 @@ def send__live_comment(data):
56
56
  platform = "FACEBOOK"
57
57
  page_id = ""
58
58
  post_id = ""
59
+ group_id = ""
59
60
  if "page_id" in data:
60
61
  page_id = data['page_id']
61
62
  if "platform" in data:
62
63
  platform = data['platform']
63
64
  if "post_id" in data:
64
65
  post_id = data['post_id']
66
+ if "group_id" in data:
67
+ post_id = data['group_id']
65
68
  if page_id == "" or post_id == "":
66
69
  info = get_live_info(data)
67
70
  platform_list = jsonpath(info, "$..relatedPostList..platform")
68
71
  i = platform_list.index(platform)
69
72
  page_id = info["data"]["relatedPostList"][i]["page_id"]
70
73
  platform = info["data"]["relatedPostList"][i]["platform"]
71
- post_id = info["data"]["relatedPostList"][i]["post_id"]
74
+ post_id = info["data"]["relatedPostList"][i]["post_id"]
75
+ group_id = info["data"]["relatedPostList"][i]["group_id"]
72
76
  # info = get_live_info(data)
73
77
  # related_post_list = info["data"]["relatedPostList"][0]
74
78
  # page_id = related_post_list["page_id"]
@@ -95,21 +99,21 @@ def send__live_comment(data):
95
99
  "promotion_status": "inactive", "id": post_id}, "message": keyword, "item": "comment",
96
100
  "verb": "add", "post_id": post_id, "comment_id": comment_id,
97
101
  "created_time": stamp, "parent_id": post_id}}]}]}
98
- # if platform == "FACEBOOK":
99
- # body = {"object": "page", "entry": [{"id": page_id, "time": stamp, "changes": [{"field": "feed", "value": {
100
- # "from": {"id": user_id, "name": name},
101
- # "post": {"status_type": "added_video", "is_published": True, "updated_time": "2022-11-18T09:57:26+0000",
102
- # "permalink_url": "https://www.facebook.com/permalink.php?story_fbid=pfbid02jLK3e6YdFSXp2DmD7j7vtStLXoBzTi8rxKrp6jFhVMUTTEgz6qvZA8soR9Uwydd8l&id=107977035056574",
103
- # "promotion_status": "inactive", "id": post_id}, "message": keyword, "item": "comment",
104
- # "verb": "add", "post_id": post_id, "comment_id": comment_id,
105
- # "created_time": stamp, "parent_id": post_id}}]}]}
106
- if platform == "INSTAGRAM":
102
+
103
+ if platform.upper() == "INSTAGRAM":
107
104
  body = {"entry": [{"id": page_id, "time": stamp, "changes": [{"value": {"from": {"id": user_id,
108
105
  "username": name},
109
106
  "media": {"id": post_id,
110
107
  "media_product_type": "FEED"},
111
108
  "id": comment_id, "text": keyword},
112
109
  "field": "comments"}]}], "object": "instagram"}
110
+ elif platform.upper() == "FB_GROUP":
111
+ t_time = stamp*1000
112
+ post_id = post_id.split("_")[-1]
113
+ comment_id = "%d%d" % ( stamp, num)
114
+ body = {"object":"page","entry":[{"id":page_id,"time":t_time,"messaging":[{"recipient":{"id":page_id},"message":keyword,
115
+ "from":{"id":user_id,"name":name},"group_id":group_id,"post_id":post_id,"comment_id":comment_id,"created_time":stamp,"item":"comment",
116
+ "verb":"add","parent_id":post_id,"field":"group_feed"}]}]}
113
117
  print(body)
114
118
  url = "%s/facebook/webhook" % env
115
119
  sign_text = hmac.new(key.encode("utf-8"), json.dumps(body).encode("utf-8"), sha1)
@@ -392,6 +392,9 @@ def get_page_post(data):
392
392
  response =requests.get(url,headers=headers,params=params).json()
393
393
  return response
394
394
 
395
+
396
+
397
+
395
398
  def relate_post(data):
396
399
  """
397
400
  链接贴文,只链接返回的第一个可链接的贴文
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.3.6
3
+ Version: 2.3.7
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='sc-common-interface',
5
- version='2.3.6',
5
+ version='2.3.7',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),