huangyifan 1 год назад
Родитель
Сommit
6b6c0e1fd0
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      sync_get_open_listing_data.py

+ 3 - 2
sync_get_open_listing_data.py

@@ -8,6 +8,7 @@ from sp_api.util import throttle_retry, load_all_pages
 from sp_api.api import Orders,ListingsItems,Inventories,Reports,CatalogItems
 from sp_api.base import Marketplaces,ReportType,ProcessingStatus
 import pandas as pd
+from random import shuffle
 import gzip
 from io import BytesIO,StringIO
 from datetime import datetime, timedelta,timezone
@@ -584,7 +585,7 @@ class SpApiRequest:
     def get_allShops(cls,data_type=Literal["GET_FLAT_FILE_OPEN_LISTINGS_DATA","GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL"]):
         df = cls.auth_info()
         refreshtoken_list = (df['refresh_token'].to_numpy().tolist())
-        refreshtoken_list.reverse()
+        shuffle(refreshtoken_list)
         for refresh_token in refreshtoken_list:
             aws_credentials = {
                 'refresh_token': refresh_token,
@@ -718,7 +719,7 @@ class SpApiRequest:
 def func_run():
     SpApiRequest.get_allShops("GET_FLAT_FILE_OPEN_LISTINGS_DATA")
 
-# func_run()
+func_run()
 if __name__ == '__main__':
     sched = BlockingScheduler()
     sched.add_job(func_run,'cron',hour=1,minute=30,second=0)