Sfoglia il codice sorgente

Merge branch 'yifan' of ASJ_ADS/sync_amz_data into master

yifan_huang96 1 anno fa
parent
commit
a201d98a9d
2 ha cambiato i file con 10 aggiunte e 4 eliminazioni
  1. 9 3
      sync_amz_data/public/sp_api_client.py
  2. 1 1
      sync_get_order_data.py

+ 9 - 3
sync_amz_data/public/sp_api_client.py

@@ -1021,9 +1021,15 @@ class SpApiRequest:
             SpApiRequest.data_judge(refresh_token,sp_api, data_type, seller_id, auth_conn,days=days,**a_kw)
         except Exception as e:
             print(e)
-            time.sleep(10)
-            SpApiRequest.data_judge(refresh_token,sp_api, data_type, seller_id, auth_conn,days=days,**a_kw)
-
+            try:
+                print('first time to try...')
+                time.sleep(10)
+                SpApiRequest.data_judge(refresh_token,sp_api, data_type, seller_id, auth_conn,days=days,**a_kw)
+            except Exception as e:
+                print(e)
+                print('twice time to try...')
+                time.sleep(20)
+                SpApiRequest.data_judge(refresh_token, sp_api, data_type, seller_id, auth_conn, days=days, **a_kw)
     @staticmethod
     def data_judge(refresh_token,sp_api,data_type,seller_id,auth_conn,days=-1,**kwargs):
         a_kw = kwargs

+ 1 - 1
sync_get_order_data.py

@@ -11,7 +11,7 @@ def func_run():
     except Exception as e:
         print(e)
     try:
-        for days in range(-2,-3,-4):
+        for days in (-2,-3,-4): #range(-34,-2):#
            sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"SKU"})
            sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"PARENT"})
            sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"CHILD"})