sc-common-interface 2.1.1__tar.gz → 2.1.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.1.1
3
+ Version: 2.1.2
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -0,0 +1,7 @@
1
+ from enum import Enum
2
+
3
+
4
+ class Platform(Enum):
5
+ FACEBOOK = 1
6
+ INSTAGRAM = 2
7
+ FB_GROUP = 3
@@ -8,6 +8,8 @@ import random
8
8
  import hmac
9
9
  from hashlib import sha1
10
10
  import random
11
+ from Platform import Platform
12
+
11
13
 
12
14
 
13
15
  platform = "FACEBOOK"
@@ -348,30 +350,32 @@ def get_page_post(data):
348
350
  :return:响应
349
351
  """
350
352
  #时间戳转换
351
- #1.最近7天
352
- current_time = datetime.datetime.now()
353
- last3 = int((current_time - datetime.timedelta(days=3)).timestamp())
353
+
354
354
 
355
355
 
356
356
  env = data["env"]
357
357
  headers = data["headers"]
358
358
  platform = "FACEBOOK"
359
+ type = "POST"
360
+ days = 180
361
+ current_time = datetime.datetime.now()
362
+ since = int((current_time - datetime.timedelta(days=days)).timestamp())
363
+ if "type" in data:
364
+ type = data["type"]
359
365
  if "platform" in data:
360
366
  platform = data["platform"].upper()
361
367
  if "page_id" in data:
362
368
  page_id = data["page_id"]
363
369
  else:
364
370
  page_id, page_name, group_id = get_channel_info(data)
365
- if platform=="FB_GROUP":
371
+ if platform==Platform.FB_GROUP.name:
366
372
  page_id = group_id
367
- type = "POST"
368
- if "type" in data:
369
- type = data["type"]
370
- days = 180
371
- since = int((current_time - datetime.timedelta(days=int(days))).timestamp())
373
+ type = "GROUP_POST"
374
+ since = int((current_time - datetime.timedelta(days=7)).timestamp())
372
375
  if "days" in data:
373
376
  days = data["days"]
374
377
  since = int((current_time - datetime.timedelta(days=int(days))).timestamp())
378
+
375
379
  # since = 1699027200
376
380
  # if "since" in data:
377
381
  # since = data["since"]
@@ -380,6 +384,7 @@ def get_page_post(data):
380
384
  page_size = data
381
385
  params = {"page_size":page_size,"type":type,"since":since,"party_channel_id":page_id,"platform":platform}
382
386
  url = "%s/api/posts/post"%env
387
+ print("params",params)
383
388
  response =requests.get(url,headers=headers,params=params).json()
384
389
  return response
385
390
 
@@ -1158,7 +1163,7 @@ def modify_message(data):
1158
1163
  headers = data["headers"]
1159
1164
  sales_id = data["sales_id"]
1160
1165
 
1161
- url = "api/posts/post/sales/%s/keyword_message"%sales_id
1166
+ url = "%s/api/posts/post/sales/%s/keyword_message"%(env,sales_id)
1162
1167
  need_send_message = True
1163
1168
  if "need_send_message" in data:
1164
1169
  need_send_message = data["need_send_message"]
@@ -1315,7 +1320,10 @@ def end_post(data):
1315
1320
 
1316
1321
 
1317
1322
  if __name__=="__main__":
1318
- pass
1319
-
1320
-
1323
+ data = {'env': 'https://front-admin.shoplineapp.com', 'headers': {'Content-Type': 'application/json',
1324
+ 'authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI3YjdiM2E1MzU4M2IwYzlhZGVhODkyZDY3OTJlNTNlMSIsImRhdGEiOnsibWVyY2hhbnRfaWQiOiI2MWIwOTZiZWI3YmVmMTAwMjQ1ZGJkOGIiLCJhcHBsaWNhdGlvbl9pZCI6IjYyN2M3NTBhMDYyMzcwMDAwYWZlNWVmZCJ9LCJpc3MiOiJodHRwczovL2RldmVsb3BlcnMuc2hvcGxpbmVhcHAuY29tIiwiYXVkIjpbXSwic3ViIjoiNjFiMDk2YmViN2JlZjEwMDI0NWRiZDhiIn0.mkq54BMp-20y8oiw0qc9caeUzH-vT6oRkeUCpZrt1jI',
1325
+ 'lang': 'en'}, 'platform': 'FACBOOK',
1326
+ 'patternModel': 'INCLUDE_MATCH', 'title': 'river接口自动化测试搜索贴文销售列表使用', "sales_id": 68242}
1327
+ response = modify_message(data)
1328
+ print(response)
1321
1329
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -1,4 +1,5 @@
1
1
  setup.py
2
+ sc_common_interface/Platform.py
2
3
  sc_common_interface/PostCommonInterface.py
3
4
  sc_common_interface/__init__.py
4
5
  sc_common_interface.egg-info/PKG-INFO
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='sc-common-interface',
5
- version='2.1.1',
5
+ version='2.1.2',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),