sc-common-interface 2.5.9__tar.gz → 2.6.0__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.5.9
3
+ Version: 2.6.0
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -197,8 +197,17 @@ def get_live_info(data):
197
197
  headers = data["headers"]
198
198
  sales_id = data["sales_id"]
199
199
  url = "%s/api/posts/live/sales/%s" % (env, sales_id)
200
- response = requests.get(url,headers=headers).json()
201
- return response
200
+ count = 0
201
+ while True:
202
+ response = requests.get(url,headers=headers)
203
+ if response.status_code==200:
204
+ return response.json()
205
+ else:
206
+ count=count+1
207
+ if count>10:
208
+ print("查询报错")
209
+ return response
210
+
202
211
 
203
212
 
204
213
 
@@ -700,11 +709,18 @@ def create_live(data):
700
709
  },
701
710
  "postConfigMap":{}
702
711
  }
703
- response = requests.post(url,headers=headers,json=body).json()
712
+ count = 0
713
+ while True:
714
+ response = requests.post(url,headers=headers,json=body)
715
+ if response.status_code==200 and response.json()["code"]=="SUCCESS":
716
+ sales_id = response.json()["data"]["sales"]["id"]
717
+ return sales_id
718
+ else:
719
+ count=count+1
720
+ if count>10:
721
+ return response
722
+
704
723
  # print(json.dumps(body))
705
- print(response)
706
- sales_id = response["data"]["sales"]["id"]
707
- return sales_id
708
724
 
709
725
 
710
726
  def add_live(data):
@@ -1505,10 +1521,16 @@ def get_product_set(data):
1505
1521
  url = "%s/admin/api/bff-web/live/sale/%s/product/product_set/list"%(env,sales_id)
1506
1522
  param = {"pageNum":pageNum,"pageSize":10,"query":query}
1507
1523
  # print(param)
1524
+ count = 0
1508
1525
  while True:
1509
1526
  res = requests.get(url, headers=headers, params=param)
1510
1527
  if res.status_code==200:
1511
1528
  return res.json()
1529
+ else:
1530
+ count+=1
1531
+ if count>10:
1532
+ print("查询get_product_set 异常")
1533
+ return res
1512
1534
 
1513
1535
  def get_sales_keyword(data):
1514
1536
  env = data["env"]
@@ -1582,10 +1604,16 @@ def get_produnct_set_detail(data):
1582
1604
  "pageNum": 1,
1583
1605
  "pageSize": 101
1584
1606
  }
1607
+ count = 0
1585
1608
  while True:
1586
1609
  response = requests.post(url, headers=headers, json=body)
1587
1610
  if response.status_code==200:
1588
1611
  return response.json()
1612
+ else:
1613
+ count+=1
1614
+ if count>10:
1615
+ print("查询get_produnct_set_detail 异常")
1616
+ return response
1589
1617
 
1590
1618
 
1591
1619
  def add_specific_product_set_to_live(data):
@@ -1726,5 +1754,6 @@ def add_all_product_set_to_live(data):
1726
1754
  break
1727
1755
 
1728
1756
  if __name__=="__main__":
1729
- pass
1730
-
1757
+ a =1
1758
+ a+=1
1759
+ print(a)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.5.9
3
+ Version: 2.6.0
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.5.9',
5
+ version='2.6.0',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),