Browse Source

代码优化

wengao 1 year ago
parent
commit
cb78d7085e
1 changed files with 12 additions and 0 deletions
  1. 12 0
      sync_amz_data/public/amz_ad_client.py

+ 12 - 0
sync_amz_data/public/amz_ad_client.py

@@ -293,6 +293,18 @@ class SPClient(BaseClient):
                 }
         return self._request(url_path,method="POST",body=body)
 
+    def iter_bidrecommendationList(self, adGroupId, expressions):
+        for i in range(0,len(expressions), 10):
+            try:
+                info = self.get_bidrecommendationList(adGroupId, expressions[i:i+10])
+                out = info['recommendations']
+                for i in out:
+                    i['adGroupId'] = adGroupId
+                yield from out
+            except:
+                # print("空值")
+                return iter([])
+
     def get_campaignNegativekeyword(self,**body):
         url_path = '/sp/campaignNegativeKeywords/list'
         headers = {