|
@@ -33,7 +33,8 @@ class SbKeyword:
|
|
|
self.profile_id = profile_id
|
|
|
self.portfolioId = campaignId
|
|
|
self.re_url_path = "api/ad_manage/profiles/"
|
|
|
- self.upcreate_url_path = "api/ad_manage/sbkeywords/updata/"
|
|
|
+ self.gid_url_path = "api/ad_manage/getsbadgroupId/"
|
|
|
+ self.upcreate_url_path = "api/ad_manage/sbkeywords/p/updata/"
|
|
|
self.heads = {'X-Token': "da4ab6bc5cbf1dfa"}
|
|
|
self.refresh_token = self.get_refresh_token()
|
|
|
self.lwa_client_id = AWS_LWA_CLIENT['lwa_client_id']
|
|
@@ -57,6 +58,23 @@ class SbKeyword:
|
|
|
out = None
|
|
|
return out
|
|
|
|
|
|
+ def get_adgroup_data(self):
|
|
|
+ heads = self.heads
|
|
|
+ url_path = self.gid_url_path
|
|
|
+ data = []
|
|
|
+ page = 1
|
|
|
+ params = {'profile_id': self.profile_id, 'limit': 999, 'page': page}
|
|
|
+ tem = request(url_path=url_path, head=heads, params=params)
|
|
|
+ data.extend(tem.get('data'))
|
|
|
+ while tem.get('is_next') is True:
|
|
|
+ page += 1
|
|
|
+ params = {'profile_id': self.profile_id, 'limit': 999, 'page': page}
|
|
|
+ tem = request(url_path=url_path, head=heads, params=params)
|
|
|
+ data.extend(tem.get('data'))
|
|
|
+ df = pd.json_normalize(data)
|
|
|
+ out_list_id = df.adGroupId.to_list()
|
|
|
+ return out_list_id
|
|
|
+
|
|
|
def get_sbkeywords_data(self):
|
|
|
tem = SBClient(**self.AWS_CREDENTIALS)
|
|
|
_ = tem.iter_keywords()
|