Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
Converted Integer format of IDs into String for DCM API
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 548813430
  • Loading branch information
StarThinker Team authored and copybara-github committed Jul 17, 2023
1 parent fd9cd98 commit b596df0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions starthinker/task/traffic/ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _wait_creative_activation(self, creative_id, timeout=128):
# this Bulkdozer session
if store.get('CREATIVE', creative_id):
creative = self._api_creatives().get(
profileId=self.profile_id, id=creative_id).execute()
profileId=self.profile_id, id=str(creative_id)).execute()
wait = 2

while not creative['active'] and timeout > 0:
Expand All @@ -95,7 +95,7 @@ def _wait_creative_activation(self, creative_id, timeout=128):
timeout -= wait
wait *= 2
creative = self._api_creatives().get(
profileId=self.profile_id, id=creative_id).execute()
profileId=self.profile_id, id=str(creative_id)).execute()

if not creative['active']:
raise Exception(
Expand Down
4 changes: 2 additions & 2 deletions starthinker/task/traffic/creative_association.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ def process(self, feed_item):
feed_item[FieldMap.CAMPAIGN_ID] = campaign['id']
feed_item[FieldMap.CAMPAIGN_NAME] = campaign['name']

association = {'creativeId': creative['id']}
association = {'creativeId': str(creative['id'])}

result = self._api().insert(
profileId=self.profile_id,
campaignId=campaign['id'],
campaignId=str(campaign['id']),
body=association).execute()

feed_item[FieldMap.CAMPAIGN_CREATIVE_ASSOCIATION_ID] = '%s|%s' % (
Expand Down
3 changes: 2 additions & 1 deletion starthinker/task/traffic/dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def _get(self, feed_item):
"""
#print('hitting the api to get %s, %s' % (self._entity, feed_item[self._id_field]))
return self._api().get(
profileId=self.profile_id, id=feed_item[self._id_field]).execute()
profileId=self.profile_id,
id=str(feed_item[self._id_field])).execute()

def get(self, feed_item, required=False, column_name=None):
"""Retrieves an item.
Expand Down
2 changes: 1 addition & 1 deletion starthinker/task/traffic/dynamic_targeting_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _key_exists(self, advertiser_id, key_name):
if not cache_key in self._key_cache:
keys = self._api().list(
profileId=self.profile_id,
advertiserId=advertiser_id,
advertiserId=str(advertiser_id),
names=[key_name]).execute()

self._key_cache[cache_key] = 'dynamicTargetingKeys' in keys and len(
Expand Down
4 changes: 2 additions & 2 deletions starthinker/util/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def get_profile_for_api(config, auth, account_id=None):
account_id=int(account_id)

for p in API_DCM(config, auth, iterate=True).userProfiles().list().execute():
p_id = int(p['profileId'])
a_id = int(p['accountId'])
p_id = str(p['profileId'])
a_id = str(p['accountId'])

# take the first profile for admin
if a_id == 2515 and 'subAccountId' not in p:
Expand Down

0 comments on commit b596df0

Please sign in to comment.