Skip to content

Commit ba4f0f0

Browse files
committed
v13.0.11
1 parent 7302d0f commit ba4f0f0

16 files changed

+671
-260
lines changed

HISTORY.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
.. :changelog:
22
33
Release History
4+
5+
13.0.11(2021-08-20)
6+
+++++++++++++++++++++++++
7+
* 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.
8+
* Add mapping for new DynamicDescriptionEnabled and DisclaimerSetting fields in BulkCampaign.
9+
* Add BulkDisclaimerAdExtension and BulkCampaignDisclaimerAdExtension mapping for disclaimer ads support.
10+
411
13.0.10(2021-06-20)
512
+++++++++++++++++++++++++
613

bingads/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
VERSION = '13.0.10'
2+
VERSION = '13.0.11'
33
BULK_FORMAT_VERSION_6 = '6.0'
44
WORKING_NAME = 'BingAdsSDKPython'
55
USER_AGENT = '{0} {1} {2}'.format(WORKING_NAME, VERSION, sys.version_info[0:3])

bingads/v13/bulk/entities/ad_extensions/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
from .bulk_promotion_ad_extensions import *
1414
from .bulk_filterlink_ad_extensions import *
1515
from .bulk_flyer_ad_extensions import *
16-
from .bulk_video_ad_extensions import *
16+
from .bulk_video_ad_extensions import *
17+
from .bulk_disclaimer_ad_extensions import *
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping
2+
from bingads.v13.internal.bulk.string_table import _StringTable
3+
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13
4+
5+
from .common import _BulkAdExtensionBase
6+
from .common import _BulkAdGroupAdExtensionAssociation
7+
from .common import _BulkCampaignAdExtensionAssociation
8+
from .common import _BulkAccountAdExtensionAssociation
9+
10+
from bingads.v13.internal.extensions import *
11+
12+
13+
_DisclaimerAdExtension = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('DisclaimerAdExtension'))
14+
15+
16+
class BulkDisclaimerAdExtension(_BulkAdExtensionBase):
17+
""" Represents a disclaimer ad extension.
18+
19+
This class exposes the :attr:`disclaimer_ad_extension` property that can be read and written
20+
as fields of the Disclaimer Ad Extension record in a bulk file.
21+
22+
For more information, see Disclaimer Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
23+
24+
*See also:*
25+
26+
* :class:`.BulkServiceManager`
27+
* :class:`.BulkOperation`
28+
* :class:`.BulkFileReader`
29+
* :class:`.BulkFileWriter`
30+
"""
31+
32+
def __init__(self, account_id=None, ad_extension=None):
33+
if ad_extension and not isinstance(ad_extension, _DisclaimerAdExtension):
34+
raise ValueError('The type of ad_extension is: {0}, should be: {1}'.format(
35+
type(ad_extension),
36+
'DisclaimerAdExtension'
37+
))
38+
super(BulkDisclaimerAdExtension, self).__init__(
39+
account_id=account_id,
40+
ad_extension=ad_extension
41+
)
42+
43+
@property
44+
def disclaimer_ad_extension(self):
45+
""" The disclaimer ad extension.
46+
47+
see Disclaimer Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
48+
"""
49+
50+
return self._ad_extension
51+
52+
@disclaimer_ad_extension.setter
53+
def disclaimer_ad_extension(self, value):
54+
self._ad_extension = value
55+
56+
_MAPPINGS = [
57+
_SimpleBulkMapping(
58+
header=_StringTable.DisclaimerName,
59+
field_to_csv=lambda c: bulk_str(c.disclaimer_ad_extension.Name),
60+
csv_to_field=lambda c, v: setattr(c.disclaimer_ad_extension, 'Name', v)
61+
),
62+
_SimpleBulkMapping(
63+
header=_StringTable.DisclaimerTitle,
64+
field_to_csv=lambda c: bulk_str(c.disclaimer_ad_extension.Title),
65+
csv_to_field=lambda c, v: setattr(c.disclaimer_ad_extension, 'Title', v)
66+
),
67+
_SimpleBulkMapping(
68+
header=_StringTable.DisclaimerPopupText,
69+
field_to_csv=lambda c: bulk_str(c.disclaimer_ad_extension.PopupText),
70+
csv_to_field=lambda c, v: setattr(c.disclaimer_ad_extension, 'PopupText', v)
71+
),
72+
_SimpleBulkMapping(
73+
header=_StringTable.DisclaimerLineText,
74+
field_to_csv=lambda c: bulk_str(c.disclaimer_ad_extension.LineText),
75+
csv_to_field=lambda c, v: setattr(c.disclaimer_ad_extension, 'LineText', v)
76+
),
77+
_SimpleBulkMapping(
78+
header=_StringTable.DisclaimerLayout,
79+
field_to_csv=lambda c: bulk_str(c.disclaimer_ad_extension.DisclaimerLayout),
80+
csv_to_field=lambda c, v: setattr(c.disclaimer_ad_extension, 'DisclaimerLayout', v)
81+
),
82+
_SimpleBulkMapping(
83+
header=_StringTable.FinalUrl,
84+
field_to_csv=lambda c: field_to_csv_Urls(c.disclaimer_ad_extension.FinalUrls, c.disclaimer_ad_extension.Id),
85+
csv_to_field=lambda c, v: csv_to_field_Urls(c.disclaimer_ad_extension.FinalUrls, v)
86+
),
87+
_SimpleBulkMapping(
88+
header=_StringTable.FinalMobileUrl,
89+
field_to_csv=lambda c: field_to_csv_Urls(c.disclaimer_ad_extension.FinalMobileUrls, c.disclaimer_ad_extension.Id),
90+
csv_to_field=lambda c, v: csv_to_field_Urls(c.disclaimer_ad_extension.FinalMobileUrls, v)
91+
),
92+
_SimpleBulkMapping(
93+
header=_StringTable.TrackingTemplate,
94+
field_to_csv=lambda c: bulk_optional_str(c.disclaimer_ad_extension.TrackingUrlTemplate, c.disclaimer_ad_extension.Id),
95+
csv_to_field=lambda c, v: setattr(c.disclaimer_ad_extension, 'TrackingUrlTemplate', v if v else '')
96+
),
97+
_SimpleBulkMapping(
98+
header=_StringTable.CustomParameter,
99+
field_to_csv=lambda c: field_to_csv_UrlCustomParameters(c.disclaimer_ad_extension),
100+
csv_to_field=lambda c, v: csv_to_field_UrlCustomParameters(c.disclaimer_ad_extension, v)
101+
),
102+
_SimpleBulkMapping(
103+
header=_StringTable.FinalUrlSuffix,
104+
field_to_csv=lambda c: bulk_optional_str(c.disclaimer_ad_extension.FinalUrlSuffix, c.disclaimer_ad_extension.Id),
105+
csv_to_field=lambda c, v: setattr(c.disclaimer_ad_extension, 'FinalUrlSuffix', v)
106+
)
107+
]
108+
109+
def process_mappings_from_row_values(self, row_values):
110+
self.disclaimer_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V13.create('DisclaimerAdExtension')
111+
self.disclaimer_ad_extension.Type = 'DisclaimerAdExtension'
112+
super(BulkDisclaimerAdExtension, self).process_mappings_from_row_values(row_values)
113+
row_values.convert_to_entity(self, BulkDisclaimerAdExtension._MAPPINGS)
114+
115+
def process_mappings_to_row_values(self, row_values, exclude_readonly_data):
116+
self._validate_property_not_null(self.disclaimer_ad_extension, 'disclaimer_ad_extension')
117+
super(BulkDisclaimerAdExtension, self).process_mappings_to_row_values(row_values, exclude_readonly_data)
118+
self.convert_to_values(row_values, BulkDisclaimerAdExtension._MAPPINGS)
119+
120+
class BulkCampaignDisclaimerAdExtension(_BulkCampaignAdExtensionAssociation):
121+
""" Represents a campaign level disclaimer ad extension.
122+
123+
This class exposes properties that can be read and written
124+
as fields of the Campaign Disclaimer Ad Extension record in a bulk file.
125+
126+
For more information, see Campaign Disclaimer Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
127+
128+
*See also:*
129+
130+
* :class:`.BulkServiceManager`
131+
* :class:`.BulkOperation`
132+
* :class:`.BulkFileReader`
133+
* :class:`.BulkFileWriter`
134+
"""
135+
136+
pass

bingads/v13/bulk/entities/bulk_campaign.py

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
_TargetSetting = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('TargetSetting'))
1010
_ShoppingSetting = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('ShoppingSetting'))
1111
_DsaSetting = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('DynamicSearchAdsSetting'))
12+
_DisclaimerSetting = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('DisclaimerSetting'))
1213

1314
class BulkCampaign(_SingleRecordBulkEntity):
1415
""" Represents a campaign that can be read or written in a bulk file.
@@ -109,10 +110,13 @@ def _get_shopping_setting(self):
109110

110111
def _get_target_setting(self):
111112
return self._get_setting(_TargetSetting, 'TargetSetting')
112-
113+
113114
def _get_dsa_setting(self):
114115
return self._get_setting(_DsaSetting, 'DynamicSearchAdsSetting')
115-
116+
117+
def _get_disclaimer_setting(self):
118+
return self._get_setting(_DisclaimerSetting, 'DisclaimerSetting')
119+
116120
def _get_setting(self, setting_type, setting_name):
117121
if not self.campaign.Settings.Setting:
118122
return None
@@ -144,8 +148,10 @@ def _read_campaign_type(c, v):
144148
if campaign_type.lower() == 'audience':
145149
BulkCampaign._create_campaign_setting(c.campaign, 'DynamicFeedSetting')
146150
BulkCampaign._create_campaign_setting(c.campaign, 'ShoppingSetting')
151+
BulkCampaign._create_campaign_setting(c.campaign, 'VerifiedTrackingSetting')
147152
if campaign_type.lower() == 'dynamicsearchads' or campaign_type.lower() == 'search':
148153
BulkCampaign._create_campaign_setting(c.campaign, 'DynamicSearchAdsSetting')
154+
BulkCampaign._create_campaign_setting(c.campaign, 'DisclaimerSetting')
149155

150156
@staticmethod
151157
def _create_campaign_setting(campaign, setting_type):
@@ -306,6 +312,42 @@ def _write_domain_language(c):
306312
return None
307313
return bulk_str(dsa_setting.Language)
308314

315+
@staticmethod
316+
def _read_DisclaimerAdsEnabled(c, v):
317+
if not c.campaign.CampaignType:
318+
return None
319+
disclaimer_setting = c._get_disclaimer_setting()
320+
if not disclaimer_setting:
321+
return None
322+
disclaimer_setting.DisclaimerAdsEnabled = parse_bool(v)
323+
324+
@staticmethod
325+
def _write_DisclaimerAdsEnabled(c):
326+
if not c.campaign.CampaignType:
327+
return None
328+
disclaimer_setting = c._get_disclaimer_setting()
329+
if not disclaimer_setting:
330+
return None
331+
return bulk_str(disclaimer_setting.DisclaimerAdsEnabled)
332+
333+
@staticmethod
334+
def _read_DynamicDescriptionEnabled(c, v):
335+
if not c.campaign.CampaignType:
336+
return None
337+
dsa_setting = c._get_dsa_setting()
338+
if not dsa_setting:
339+
return None
340+
dsa_setting.DynamicDescriptionEnabled = parse_bool(v)
341+
342+
@staticmethod
343+
def _write_DynamicDescriptionEnabled(c):
344+
if not c.campaign.CampaignType:
345+
return None
346+
dsa_setting = c._get_dsa_setting()
347+
if not dsa_setting:
348+
return None
349+
return bulk_str(dsa_setting.DynamicDescriptionEnabled)
350+
309351
@staticmethod
310352
def _read_page_feed_ids(c, v):
311353
if not c.campaign.CampaignType:
@@ -516,6 +558,16 @@ def _write_website(c):
516558
int(v) if v else None
517559
)
518560
),
561+
_SimpleBulkMapping(
562+
header=_StringTable.DisclaimerAdsEnabled,
563+
field_to_csv=lambda c: BulkCampaign._write_DisclaimerAdsEnabled(c),
564+
csv_to_field=lambda c, v: BulkCampaign._read_DisclaimerAdsEnabled(c, v)
565+
),
566+
_SimpleBulkMapping(
567+
header=_StringTable.DynamicDescriptionEnabled,
568+
field_to_csv=lambda c: BulkCampaign._write_DynamicDescriptionEnabled(c),
569+
csv_to_field=lambda c, v: BulkCampaign._read_DynamicDescriptionEnabled(c, v)
570+
)
519571
]
520572

521573
def read_additional_data(self, stream_reader):

bingads/v13/internal/bulk/bulk_object_factory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class _BulkObjectFactory():
2626
_StringTable.AccountFlyerAdExtension: _EntityInfo(lambda: BulkAccountFlyerAdExtension()),
2727
_StringTable.CampaignFlyerAdExtension: _EntityInfo(lambda: BulkCampaignFlyerAdExtension()),
2828
_StringTable.AdGroupFlyerAdExtension: _EntityInfo(lambda: BulkAdGroupFlyerAdExtension()),
29+
_StringTable.DisclaimerAdExtension: _EntityInfo(lambda: BulkDisclaimerAdExtension()),
30+
_StringTable.CampaignDisclaimerAdExtension: _EntityInfo(lambda: BulkCampaignDisclaimerAdExtension()),
2931
_StringTable.ImageAdExtension: _EntityInfo(lambda: BulkImageAdExtension()),
3032
_StringTable.AccountImageAdExtension: _EntityInfo(lambda: BulkAccountImageAdExtension()),
3133
_StringTable.CampaignImageAdExtension: _EntityInfo(lambda: BulkCampaignImageAdExtension()),

bingads/v13/internal/bulk/csv_headers.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class _CsvHeaders:
1616
_StringTable.ClientId,
1717
_StringTable.LastModifiedTime,
1818
_StringTable.MultiMediaAdBidAdjustment,
19+
_StringTable.DynamicDescriptionEnabled,
20+
1921

2022
# Campaign
2123
_StringTable.TimeZone,
@@ -84,6 +86,14 @@ class _CsvHeaders:
8486

8587
# AdExtensions common
8688
_StringTable.Version,
89+
90+
#Disclaimer Ad Extension
91+
_StringTable.DisclaimerAdsEnabled,
92+
_StringTable.DisclaimerName,
93+
_StringTable.DisclaimerTitle,
94+
_StringTable.DisclaimerLayout,
95+
_StringTable.DisclaimerPopupText,
96+
_StringTable.DisclaimerLineText,
8797

8898
# SiteLink Ad Extensions
8999
_StringTable.SiteLinkExtensionOrder,

bingads/v13/internal/bulk/string_table.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class _StringTable:
4646
Param2 = "Param2"
4747
Param3 = "Param3"
4848
DevicePreference = "Device Preference"
49+
VerifiedTrackingData = "Verified Tracking Setting"
4950
CampaignNegativeKeyword = "Campaign Negative Keyword"
5051
CampaignNegativeSite = "Campaign Negative Site"
5152
AdGroupNegativeKeyword = "Ad Group Negative Keyword"
@@ -91,6 +92,7 @@ class _StringTable:
9192
AutoApplyRecommendations = "Auto Apply Recommendations"
9293
AllowImageAutoRetrieve = "Allow Image Auto Retrieve"
9394
MultiMediaAdBidAdjustment = "Multi Media Ad Bid Adjustment"
95+
BusinessAttributes = "Business Attributes"
9496

9597
# Entity Types
9698
SemanticVersion = "Format Version"
@@ -111,6 +113,17 @@ class _StringTable:
111113
SocialNetworkAdExtension = "Social Network Ad Extension"
112114
Version = "Version"
113115

116+
# Disclaimer Ads
117+
DisclaimerAdsEnabled = "Disclaimer Ads Enabled"
118+
DisclaimerName = "Disclaimer Name"
119+
DisclaimerTitle = "Disclaimer Title"
120+
DisclaimerLayout = "Disclaimer Layout"
121+
DisclaimerPopupText = "Disclaimer Popup Text"
122+
DisclaimerLineText = "Disclaimer Line Text"
123+
124+
DisclaimerAdExtension = "Disclaimer Ad Extension"
125+
CampaignDisclaimerAdExtension = "Campaign Disclaimer Ad Extension"
126+
114127
# Image Ad Extension
115128
AltText = "Alternative Text"
116129
MediaIds = "Media Ids"
@@ -294,6 +307,7 @@ class _StringTable:
294307
CampaignType = "Campaign Type"
295308
CampaignPriority = "Priority"
296309
LocalInventoryAdsEnabled = "LocalInventoryAdsEnabled"
310+
DynamicDescriptionEnabled = "Dynamic Description Enabled"
297311

298312
CampaignNegativeStoreCriterion = "Campaign Negative Store Criterion"
299313

bingads/v13/proxies/production/adinsight_service.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3049,7 +3049,7 @@
30493049
</wsdl:binding>
30503050
<wsdl:service name="AdInsightService">
30513051
<wsdl:port name="BasicHttpBinding_IAdInsightService" binding="tns:BasicHttpBinding_IAdInsightService">
3052-
<soap:address location="https://adinsight.api.bingads.microsoft.com/Api/Advertiser/AdInsight/V13/AdInsightService.svc" />
3052+
<soap:address location="https://usnorth.adinsight.api.bingads.microsoft.com/Api/Advertiser/AdInsight/V13/AdInsightService.svc" />
30533053
</wsdl:port>
30543054
</wsdl:service>
30553055
</wsdl:definitions>

bingads/v13/proxies/production/bulk_service.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,20 @@
10301030
</xs:appinfo>
10311031
</xs:annotation>
10321032
</xs:enumeration>
1033+
<xs:enumeration value="DisclaimerAdExtensions">
1034+
<xs:annotation>
1035+
<xs:appinfo>
1036+
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">138</EnumerationValue>
1037+
</xs:appinfo>
1038+
</xs:annotation>
1039+
</xs:enumeration>
1040+
<xs:enumeration value="CampaignDisclaimerAdExtensions">
1041+
<xs:annotation>
1042+
<xs:appinfo>
1043+
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">139</EnumerationValue>
1044+
</xs:appinfo>
1045+
</xs:annotation>
1046+
</xs:enumeration>
10331047
</xs:restriction>
10341048
</xs:simpleType>
10351049
<xs:element name="DownloadEntity" nillable="true" type="tns:DownloadEntity" />

0 commit comments

Comments
 (0)