|
@@ -5,6 +5,7 @@ from sync_amz_data.settings import AWS_LWA_CLIENT
|
|
|
import pandas as pd
|
|
|
import json
|
|
|
from sync_amz_data.tasks.datainsert.wg import LADS
|
|
|
+import time
|
|
|
|
|
|
|
|
|
class RateLimitError(Exception):
|
|
@@ -117,10 +118,22 @@ class SpTargetsBidRecommendations:
|
|
|
return json_data
|
|
|
|
|
|
def updata_create(self):
|
|
|
- body = self.get_sptargetsbidrecommendation_data()
|
|
|
- heads = self.heads
|
|
|
- url_path = self.upcreate_url_path
|
|
|
- tem = request(url_path=url_path, head=heads, body=body, method="POST")
|
|
|
+ # body = self.get_sptargetsbidrecommendation_data()
|
|
|
+ # heads = self.heads
|
|
|
+ # url_path = self.upcreate_url_path
|
|
|
+ # tem = request(url_path=url_path, head=heads, body=body, method="POST")
|
|
|
+ my_list = self.get_sptargetsbidrecommendation_data()
|
|
|
+ chunk_size = 500
|
|
|
+ chunked_lists = [my_list[i:i + chunk_size] for i in range(0, len(my_list), chunk_size)]
|
|
|
+ temlist = []
|
|
|
+ for body in chunked_lists:
|
|
|
+ heads = self.heads
|
|
|
+ url_path = self.upcreate_url_path
|
|
|
+ tem = request(url_path=url_path, head=heads, body=body, method="POST")
|
|
|
+ temlist.append(tem)
|
|
|
+ time.sleep(1)
|
|
|
+ return temlist
|
|
|
+
|
|
|
return tem
|
|
|
|
|
|
|