ソースを参照

首次销量策略

sunhao 3 年 前
コミット
562a332098
共有1 個のファイルを変更した4 個の追加7 個の削除を含む
  1. 4 7
      live_promotion_detail_v1_sale_scraper.py

+ 4 - 7
live_promotion_detail_v1_sale_scraper.py

@@ -51,9 +51,10 @@ def scrape(request_data, heat):
51 51
             )
52 52
 
53 53
             if heat==0:
54
-                rds_list.add_request_params(request_data, heat)
55
-                print('首次失败重新插入 ' + request_data)
56
-                sys.exit(0)
54
+                if random.randint(0, 100) > 0:
55
+                    rds_list.add_request_params(request_data, heat)
56
+                    print('首次失败重新插入 ' + request_data)
57
+                    sys.exit(0)
57 58
 
58 59
             if heat>0:
59 60
                 if random.randint(0, 9) > 0:
@@ -76,17 +77,14 @@ def scrape(request_data, heat):
76 77
                 news_time = int(time.time()) + add_t
77 78
                 next_rds = promotion_id + '@' + product_id + '@' + uid + '@' + room_id + '@' + str(news_time) 
78 79
                 rds_list.push_middle_list(next_rds)
79
-                print('中间插入 ' + next_rds)
80 80
             else :
81 81
                 add_t = 1200
82 82
                 news_time = int(time.time()) + add_t
83 83
                 next_rds = promotion_id + '@' + product_id + '@' + uid + '@' + room_id + '@' + str(news_time) 
84 84
                 rds_list.push_last_list(next_rds)
85
-                print('末次插入 ' + next_rds)
86 85
 
87 86
         if (commodity_detail is None) or (commodity_detail == '') or ('real_sell_num' in commodity_detail)==False:
88 87
             sys.exit(0)
89
-            print('失败----- ')
90 88
 
91 89
         data = json.dumps({
92 90
             "data": commodity_detail,
@@ -101,7 +99,6 @@ def scrape(request_data, heat):
101 99
 
102 100
         rds_list.record_v1_score(1)
103 101
         rds_list.push_v1_data_list(data)
104
-        print('成功+++++ ')
105 102
     except Exception as e:
106 103
         rds_list.record_v1_score(0)
107 104
         rds_list.add_request_params(request_data, heat)