sc-common-interface 2.3.1__tar.gz → 2.3.2__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.1
3
+ Version: 2.3.2
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -53,11 +53,27 @@ def end_activity(data):
53
53
  def send__live_comment(data):
54
54
  env = data["env"]
55
55
  key = data["key"]
56
- info = get_live_info(data)
57
- related_post_list = info["data"]["relatedPostList"][0]
58
- page_id = related_post_list["page_id"]
59
- post_id = related_post_list["post_id"]
60
- platform = related_post_list["platform"]
56
+ platform = "FACEBOOK"
57
+ page_id = ""
58
+ post_id = ""
59
+ if "page_id" in data:
60
+ page_id = data['page_id']
61
+ if "platform" in data:
62
+ platform = data['platform']
63
+ if "post_id" in data:
64
+ post_id = data['post_id']
65
+ if page_id == "" or post_id == "":
66
+ info = get_live_info(data)
67
+ platform_list = jsonpath(info, "$..relatedPostList..platform")
68
+ i = platform_list.index(platform)
69
+ page_id = info["data"]["relatedPostList"][i]["page_id"]
70
+ platform = info["data"]["relatedPostList"][i]["platform"]
71
+ post_id = info["data"]["relatedPostList"][i]["post_id"]
72
+ # info = get_live_info(data)
73
+ # related_post_list = info["data"]["relatedPostList"][0]
74
+ # page_id = related_post_list["page_id"]
75
+ # post_id = related_post_list["post_id"]
76
+ # platform = related_post_list["platform"]
61
77
  stamp = int(time.time())
62
78
  num = random.randint(100000, 999999)
63
79
  user_id = "488864%d" % int(time.time())
@@ -88,13 +104,14 @@ def send__live_comment(data):
88
104
  "media_product_type": "FEED"},
89
105
  "id": comment_id, "text": keyword},
90
106
  "field": "comments"}]}], "object": "instagram"}
91
-
107
+ print(body)
92
108
  url = "%s/facebook/webhook" % env
93
109
  sign_text = hmac.new(key.encode("utf-8"), json.dumps(body).encode("utf-8"), sha1)
94
110
  signData = sign_text.hexdigest()
95
111
  # print("body", json.dumps(body))
96
112
  header = {"Content-Type": "application/json", "x-hub-signature": "sha1=%s" % signData}
97
113
  response = requests.post(url, headers=header, data=json.dumps(body))
114
+ print(response.text)
98
115
  return user_id, name, comment_id
99
116
 
100
117
  def send_mc_message(data):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.3.1
3
+ Version: 2.3.2
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.1',
5
+ version='2.3.2',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),