sc-common-interface 2.2.7__tar.gz → 2.2.8__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.7 → sc-common-interface-2.2.8}/PKG-INFO +1 -1
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface/LiveCommonInterface.py +50 -1
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface/PostCommonInterface.py +8 -2
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface.egg-info/PKG-INFO +1 -1
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/setup.py +1 -1
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface/Platform.py +0 -0
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface/__init__.py +0 -0
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface.egg-info/SOURCES.txt +0 -0
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface.egg-info/dependency_links.txt +0 -0
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface.egg-info/requires.txt +0 -0
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface.egg-info/top_level.txt +0 -0
- {sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/setup.cfg +0 -0
{sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface/LiveCommonInterface.py
RENAMED
|
@@ -134,9 +134,58 @@ def get_activity_detail(data):
|
|
|
134
134
|
response = requests.get(url,headers=headers).json()
|
|
135
135
|
return response
|
|
136
136
|
|
|
137
|
+
def live_search_oa_gift(data):
|
|
138
|
+
"""
|
|
139
|
+
查询oa赠品,命名转为驼峰和返回第一个赠品的信息
|
|
140
|
+
:param data:
|
|
141
|
+
:return:
|
|
142
|
+
"""
|
|
143
|
+
env = data["env"]
|
|
144
|
+
headers = data["headers"]
|
|
145
|
+
url = "%s/openApi/proxy/v1/gifts"%env
|
|
146
|
+
params = {"page":1}
|
|
147
|
+
response = requests.get(url,headers=headers,params=params).json()
|
|
148
|
+
items = response["data"]["items"]
|
|
149
|
+
|
|
150
|
+
if items == []:
|
|
151
|
+
# 新增赠品
|
|
152
|
+
body = {"unlimited_quantity": True, "title_translations": {"zh-cn": "接口自动化新增的赠品%s" % int(time.time())},
|
|
153
|
+
"media_ids": "610d2865ca92cf00264c563c"}
|
|
154
|
+
requests.post(url, headers=headers, json=body).json()
|
|
155
|
+
time.sleep(5)
|
|
156
|
+
#新增后去查询
|
|
157
|
+
response = requests.get(url, headers=headers, params=params).json()
|
|
158
|
+
items = response["data"]["items"]
|
|
159
|
+
|
|
160
|
+
# 返回数量不是0的赠品和spu_id
|
|
161
|
+
# print(json.dumps(items))
|
|
162
|
+
quantityList = jsonpath(items,"$..quantity")
|
|
163
|
+
gift_info = items[0]
|
|
164
|
+
for a,b in enumerate(quantityList):
|
|
165
|
+
if b!=0:
|
|
166
|
+
gift_info = items[a]
|
|
167
|
+
spu_id = gift_info["id"]
|
|
168
|
+
return spu_id,gift_info,response
|
|
169
|
+
|
|
170
|
+
def get_merchant_info(data):
|
|
171
|
+
env = data["env"]
|
|
172
|
+
headers = data["headers"]
|
|
173
|
+
merchant_id = data["merchant_id"]
|
|
174
|
+
url = "%s/openApi/proxy/v1/merchants/%s" % (env,merchant_id)
|
|
175
|
+
response = requests.get(url, headers=headers).json()
|
|
176
|
+
base_country_code = response["data"]["base_country_code"]
|
|
177
|
+
currency = ""
|
|
178
|
+
if base_country_code=="TW":
|
|
179
|
+
currency="NT$"
|
|
180
|
+
elif base_country_code=="TH":
|
|
181
|
+
currency = "฿"
|
|
182
|
+
elif base_country_code == "VN":
|
|
183
|
+
#放金额后面
|
|
184
|
+
currency = "₫"
|
|
185
|
+
return base_country_code,currency,response
|
|
137
186
|
|
|
138
187
|
|
|
139
188
|
|
|
140
189
|
|
|
141
190
|
if __name__=="__main__":
|
|
142
|
-
|
|
191
|
+
pass
|
{sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface/PostCommonInterface.py
RENAMED
|
@@ -159,8 +159,13 @@ def search_oa_gift(data):
|
|
|
159
159
|
response = requests.get(url, headers=headers, params=params).json()
|
|
160
160
|
items = response["data"]["items"]
|
|
161
161
|
|
|
162
|
-
#
|
|
162
|
+
# 返回赠品数量不是0
|
|
163
|
+
# print(json.dumps(items))
|
|
164
|
+
quantityList = jsonpath(items,"$..quantity")
|
|
163
165
|
gift_info = items[0]
|
|
166
|
+
for a,b in enumerate(quantityList):
|
|
167
|
+
if b!=0:
|
|
168
|
+
gift_info = items[a]
|
|
164
169
|
# 下划线命名转变为驼峰命名
|
|
165
170
|
change_dict_into_hump(gift_info)
|
|
166
171
|
|
|
@@ -938,7 +943,7 @@ def get_user_conversation_id(data):
|
|
|
938
943
|
url = "%s/mc/conversation/id?type=%s&user_id=%s&party_channel_id=%s" % (env, platform, user_id, page_id)
|
|
939
944
|
# param = {"type":"facebook","user_id":vars["user_id"],"party_channel_id":vars["platform_channel_id"]}
|
|
940
945
|
response = requests.get(url, headers=headers).json()
|
|
941
|
-
print(response)
|
|
946
|
+
# print(response)
|
|
942
947
|
conversation_id = jsonpath(response, "$.data.id")[0]
|
|
943
948
|
return conversation_id,response
|
|
944
949
|
|
|
@@ -1469,3 +1474,4 @@ if __name__=="__main__":
|
|
|
1469
1474
|
# "relationUrl": "https://www.facebook.com/groups/416632743936652/posts/823646243235298/"}
|
|
1470
1475
|
# res = relate_post(data)
|
|
1471
1476
|
# print(res)
|
|
1477
|
+
|
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface.egg-info/requires.txt
RENAMED
|
File without changes
|
{sc-common-interface-2.2.7 → sc-common-interface-2.2.8}/sc_common_interface.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|