Skip to content

Commit

Permalink
Merge pull request #252 from BingAds/v13.0.17
Browse files Browse the repository at this point in the history
v13.0.17
  • Loading branch information
xinyuwen2 authored Sep 4, 2023
2 parents 373a586 + 28dc054 commit d1ca68e
Show file tree
Hide file tree
Showing 26 changed files with 2,067 additions and 590 deletions.
10 changes: 9 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
.. :changelog:
Release History
13.0.17(2023-08-18)
+++++++++++++++++++++++++
* Update Bing Ads API Version 13 service proxies to reflect recent interface changes. For details please see the Bing Ads API Release Notes: https://learn.microsoft.com/en-us/advertising/guides/release-notes?view=bingads-13.
* Added bulk mapping for new Criterion i.e., BulkCampaignDealCriterion, BulkAdGroupGenreCriterion.
* Added mappings for new fields in BulkCampaign: DestinationChannel and IsMultiChannelCampaign.
* Added mappings for new fields in BulkResponsiveAd: VerifiedTrackingDatas.
* Added mappings for new fields in ImageAsset: TargetWidth and TargetHeight.
* Fixed issue: https://github.com/BingAds/BingAds-Python-SDK/issues/250.

13.0.16(2023-06-02)
+++++++++++++++++++++++++
* Update Bing Ads API Version 13 service proxies to reflect recent interface changes. For details please see the Bing Ads API Release Notes: https://docs.microsoft.com/en-us/bingads/guides/release-notes.
* Add bulk mappings for performance max campaign i.e., BulkAssetGroup, BulkAssetGroupListingGroup, BulkAudienceGroup, BulkAudienceGroupAssetGroupAssociation, BulkCampaignNegativeWebPage.
* Add mappings for new fields in BulkCampaign: UrlExpansionOptOut.
* Support new bidding scheme: ManualCpaScheme and CostPerSaleBiddingScheme.
* get rid of six/future as we support python3 only. Refer to https://github.com/BingAds/BingAds-Python-SDK/issues/233.

13.0.15(2022-12-23)
+++++++++++++++++++++++++
Expand Down
2 changes: 1 addition & 1 deletion bingads/manifest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
VERSION = '13.0.16'
VERSION = '13.0.17'
BULK_FORMAT_VERSION_6 = '6.0'
WORKING_NAME = 'BingAdsSDKPython'
USER_AGENT = '{0} {1} {2}'.format(WORKING_NAME, VERSION, sys.version_info[0:3])
42 changes: 40 additions & 2 deletions bingads/v13/bulk/entities/bulk_ads.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
ResponsiveSearchAd = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('ResponsiveSearchAd'))
ResponsiveAd = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('ResponsiveAd'))


class _BulkAd(_SingleRecordBulkEntity):
""" This abstract base class provides properties that are shared by all bulk ad classes.
Expand All @@ -40,7 +39,21 @@ def __init__(self,
self._ad_group_name = ad_group_name
self._ad = ad
self._performance_data = None
self._editorial_appeal_status = None

@property
def editorial_appeal_status(self):
""" The editorial appeal status of the ad.
:rtype: str
"""

return self._editorial_appeal_status

@editorial_appeal_status.setter
def editorial_appeal_status(self, editorial_appeal_status):
self._editorial_appeal_status = editorial_appeal_status

@property
def ad_group_id(self):
""" The identifier of the ad group that contains the ad.
Expand Down Expand Up @@ -164,6 +177,11 @@ def ad(self, ad):
header=_StringTable.FinalUrlSuffix,
field_to_csv=lambda c: bulk_optional_str(c.ad.FinalUrlSuffix, c.ad.Id),
csv_to_field=lambda c, v: setattr(c.ad, 'FinalUrlSuffix', v if v else None)
),
_SimpleBulkMapping(
header=_StringTable.EditorialAppealStatus,
field_to_csv=lambda c: c.editorial_appeal_status,
csv_to_field=lambda c, v: setattr(c, '_editorial_appeal_status', v)
)
]

Expand Down Expand Up @@ -599,6 +617,7 @@ def __init__(self,
ad,
)
self._ad = ad
self._verified_tracking_data = None

@property
def responsive_ad(self):
Expand All @@ -613,7 +632,21 @@ def responsive_ad(self):
def responsive_ad(self, responsive_ad):
if responsive_ad is not None and not isinstance(responsive_ad, ResponsiveAd):
raise ValueError('Not an instance of ResponsiveAd')
self._ad = responsive_ad
self._ad = responsive_ad

@property
def verified_tracking_data(self):
"""
The verified tracking data that the ad associated
Corresponds to 'Verified Tracking Setting' field in bulk file.
:rtype: ArrayOfArrayOfKeyValuePairOfstringstring
"""
return self._verified_tracking_data

@verified_tracking_data.setter
def verified_tracking_data(self, value):
self._verified_tracking_data = value

_MAPPINGS = [
_SimpleBulkMapping(
Expand Down Expand Up @@ -676,6 +709,11 @@ def responsive_ad(self, responsive_ad):
field_to_csv=lambda c: field_to_csv_TextAssetLinks(c.responsive_ad.LongHeadlines),
csv_to_field=lambda c, v: csv_to_field_TextAssetLinks(c.responsive_ad.LongHeadlines ,v)
),
_SimpleBulkMapping(
header=_StringTable.Details,
field_to_csv=lambda c: to_verified_tracking_setting_string(c.verified_tracking_data),
csv_to_field=lambda c, v: setattr(c, 'verified_tracking_data', parse_verified_tracking_setting(v) if v else None)
),
]

def process_mappings_from_row_values(self, row_values):
Expand Down
30 changes: 29 additions & 1 deletion bingads/v13/bulk/entities/bulk_campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def __init__(self, account_id=None, campaign=None):
self._budget_name = None
self._bid_strategy_name = None
self._verified_tracking_data = None
self._destination_channel = None
self._is_multi_channel_campaign = None

@property
def account_id(self):
Expand Down Expand Up @@ -119,6 +121,22 @@ def quality_score_data(self):

return self._quality_score_data

@property
def destination_channel(self):
return self._destination_channel

@destination_channel.setter
def destination_channel(self, value):
self._destination_channel = value

@property
def is_multi_channel_campaign(self):
return self._is_multi_channel_campaign

@is_multi_channel_campaign.setter
def is_multi_channel_campaign(self, value):
self._is_multi_channel_campaign = value

def _get_dynamic_feed_setting(self):
return self._get_setting(_DynamicFeedSetting, 'DynamicFeedSetting')

Expand Down Expand Up @@ -625,7 +643,17 @@ def _write_website(c):
header=_StringTable.Details,
field_to_csv=lambda c: to_verified_tracking_setting_string(c.verified_tracking_data),
csv_to_field=lambda c, v: setattr(c, 'verified_tracking_data', parse_verified_tracking_setting(v) if v else None)
)
),
_SimpleBulkMapping(
header=_StringTable.DestinationChannel,
field_to_csv=lambda c: c.destination_channel,
csv_to_field=lambda c, v: setattr(c, 'destination_channel', v)
),
_SimpleBulkMapping(
header=_StringTable.IsMultiChannelCampaign,
field_to_csv=lambda c: field_to_csv_bool(c.is_multi_channel_campaign),
csv_to_field=lambda c, v: setattr(c, 'is_multi_channel_campaign', parse_bool(v))
),
]

def read_additional_data(self, stream_reader):
Expand Down
2 changes: 2 additions & 0 deletions bingads/v13/bulk/entities/target_criterions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .bulk_campaign_age_criterion import *
from .bulk_campaign_biddable_criterion import *
from .bulk_campaign_day_time_criterion import *
from .bulk_campaign_deal_criterion import *
from .bulk_campaign_device_criterion import *
from .bulk_campaign_gender_criterion import *
from .bulk_campaign_location_criterion import *
Expand All @@ -31,3 +32,4 @@
from .bulk_ad_group_hotel_check_in_day_criterion import *
from .bulk_ad_group_hotel_date_selection_type_criterion import *
from .bulk_ad_group_hotel_length_of_stay_criterion import *
from .bulk_ad_group_genre_criterion import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from bingads.v13.bulk.entities import *
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13
from bingads.v13.bulk.entities.target_criterions.bulk_ad_group_biddable_criterion import BulkAdGroupBiddableCriterion
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v13.internal.bulk.string_table import _StringTable
from bingads.v13.internal.extensions import *


class BulkAdGroupGenreCriterion(BulkAdGroupBiddableCriterion):
""" Represents an Ad Group Genre Criterion that can be read or written in a bulk file.
This class exposes the :attr:`biddable_ad_group_criterion` property that can be read and written as fields of the
Ad Group Genre Criterion record in a bulk file.
For more information, see Ad Group Genre Criterion at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""

def __init__(self,
biddable_ad_group_criterion=None,
campaign_name=None,
ad_group_name=None, ):
super(BulkAdGroupGenreCriterion, self).__init__(biddable_ad_group_criterion, campaign_name, ad_group_name)

_MAPPINGS = [
_SimpleBulkMapping(
_StringTable.Target,
field_to_csv=lambda c: field_to_csv_GenreId(c.biddable_ad_group_criterion),
csv_to_field=lambda c, v: csv_to_field_GenreId(c.biddable_ad_group_criterion, v)
)
]

def create_criterion(self):
self._biddable_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('GenreCriterion')
self._biddable_ad_group_criterion.Criterion.Type = 'GenreCriterion'

def process_mappings_to_row_values(self, row_values, exclude_readonly_data):
super(BulkAdGroupGenreCriterion, self).process_mappings_to_row_values(row_values, exclude_readonly_data)
self.convert_to_values(row_values, BulkAdGroupGenreCriterion._MAPPINGS)

def process_mappings_from_row_values(self, row_values):
super(BulkAdGroupGenreCriterion, self).process_mappings_from_row_values(row_values)
row_values.convert_to_entity(self, BulkAdGroupGenreCriterion._MAPPINGS)

def read_additional_data(self, stream_reader):
super(BulkAdGroupGenreCriterion, self).read_additional_data(stream_reader)
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from bingads.v13.bulk.entities import *
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13
from bingads.v13.bulk.entities.target_criterions.bulk_campaign_biddable_criterion import BulkCampaignBiddableCriterion
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v13.internal.bulk.string_table import _StringTable
from bingads.v13.internal.extensions import *

class BulkCampaignDealCriterion(BulkCampaignBiddableCriterion):
""" Represents an Campaign Deal Criterion that can be read or written in a bulk file.
This class exposes the :attr:`biddable_campaign_criterion` property that can be read and written as fields of the
Campaign Deal Criterion record in a bulk file.
For more information, see Campaign Deal Criterion at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""

def __init__(self,
biddable_campaign_criterion=None,
campaign_name=None, ):
super(BulkCampaignDealCriterion, self).__init__(biddable_campaign_criterion, campaign_name)

_MAPPINGS = [
_SimpleBulkMapping(
_StringTable.Target,
field_to_csv=lambda c: field_to_csv_DealTarget(c.biddable_campaign_criterion),
csv_to_field=lambda c, v: csv_to_field_DealTarget(c.biddable_campaign_criterion, v)
)
]

def create_criterion(self):
self._biddable_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('DealCriterion')
self._biddable_campaign_criterion.Criterion.Type = 'DealCriterion'

def process_mappings_to_row_values(self, row_values, exclude_readonly_data):
super(BulkCampaignDealCriterion, self).process_mappings_to_row_values(row_values, exclude_readonly_data)
self.convert_to_values(row_values, BulkCampaignDealCriterion._MAPPINGS)

def process_mappings_from_row_values(self, row_values):
super(BulkCampaignDealCriterion, self).process_mappings_from_row_values(row_values)
row_values.convert_to_entity(self, BulkCampaignDealCriterion._MAPPINGS)

def read_additional_data(self, stream_reader):
super(BulkCampaignDealCriterion, self).read_additional_data(stream_reader)
2 changes: 2 additions & 0 deletions bingads/v13/internal/bulk/bulk_object_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class _BulkObjectFactory():
_StringTable.CampaignCompanyNameCriterion: _EntityInfo(lambda: BulkCampaignCompanyNameCriterion()),
_StringTable.CampaignJobFunctionCriterion: _EntityInfo(lambda: BulkCampaignJobFunctionCriterion()),
_StringTable.CampaignIndustryCriterion: _EntityInfo(lambda: BulkCampaignIndustryCriterion()),
_StringTable.CampaignDealCriterion: _EntityInfo(lambda: BulkCampaignDealCriterion()),
_StringTable.CombinedList: _EntityInfo(lambda: BulkCombinedList()),
_StringTable.CustomerList: _EntityInfo(lambda: BulkCustomerList()),
_StringTable.CustomerListItem: _EntityInfo(lambda: BulkCustomerListItem()),
Expand All @@ -173,6 +174,7 @@ class _BulkObjectFactory():
_StringTable.AdGroupNegativeGenderCriterion: _EntityInfo(lambda: BulkAdGroupNegativeGenderCriterion()),
_StringTable.AdGroupNegativeIndustryCriterion: _EntityInfo(lambda: BulkAdGroupNegativeIndustryCriterion()),
_StringTable.AdGroupNegativeJobFunctionCriterion: _EntityInfo(lambda: BulkAdGroupNegativeJobFunctionCriterion()),
_StringTable.AdGroupGenreCriterion: _EntityInfo(lambda: BulkAdGroupGenreCriterion()),
_StringTable.Label: _EntityInfo(lambda: BulkLabel()),
_StringTable.CampaignLabel: _EntityInfo(lambda: BulkCampaignLabel()),
_StringTable.AdGroupLabel: _EntityInfo(lambda: BulkAdGroupLabel()),
Expand Down
2 changes: 2 additions & 0 deletions bingads/v13/internal/bulk/csv_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class _CsvHeaders:
_StringTable.BudgetType,
_StringTable.BudgetName,
_StringTable.BudgetId,
_StringTable.DestinationChannel,
_StringTable.IsMultiChannelCampaign,

# AdGroup
_StringTable.StartDate,
Expand Down
10 changes: 8 additions & 2 deletions bingads/v13/internal/bulk/string_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ class _StringTable:
AdGroupNegativeGenderCriterion = "Ad Group Negative Gender Criterion"
AdGroupNegativeIndustryCriterion = "Ad Group Negative Industry Criterion"
AdGroupNegativeJobFunctionCriterion = "Ad Group Negative Job Function Criterion"

AdGroupGenreCriterion = "Ad Group Genre Criterion"

# Responsive Ad
ResponsiveAd = "Responsive Ad"
Expand Down Expand Up @@ -606,6 +606,7 @@ class _StringTable:
CampaignCompanyNameCriterion = 'Campaign Company Name Criterion'
CampaignJobFunctionCriterion = 'Campaign Job Function Criterion'
CampaignIndustryCriterion = 'Campaign Industry Criterion'
CampaignDealCriterion = 'Campaign Deal Criterion'

# Online Conversion
OnlineConversionAdjustment = "Online Conversion Adjustment"
Expand Down Expand Up @@ -633,7 +634,7 @@ class _StringTable:
# Campaign Conversion Goal
CampaignConversionGoal = "Campaign Conversion Goal"
GoalId = "Goal Id"

# PMax
AssetGroup = "Asset Group"
AudienceGroup = "Audience Group"
Expand All @@ -645,3 +646,8 @@ class _StringTable:
AgeRanges = "Age Ranges"
GenderTypes = "Gender Types"
ParentListingGroupId = "Parent Listing Group Id"

# MultiChannel Campaign
DestinationChannel = "Destination Channel"
IsMultiChannelCampaign = "Is Multi Channel Campaign"

Loading

0 comments on commit d1ca68e

Please sign in to comment.