Skip to content

Commit cb0509e

Browse files
committed
update to version 11.12.3
1 parent 20d87e2 commit cb0509e

File tree

14 files changed

+269
-19
lines changed

14 files changed

+269
-19
lines changed

HISTORY.rst

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,50 @@
11
.. :changelog:
22
33
Release History
4+
-----------
5+
11.12.3(2018-06-10)
6+
Added support for Cooperative bidding e.g., added mappings for "Bid Boost Value", "Bid Option" and "Maximum Bid" fields via the BulkAdGroup.
7+
8+
Added mappings for the 'MSCLKID Auto Tagging Enabled" and "Tracking Tempalte" fields via the BulkAccount.
9+
410
-----------
511
11.12.2(2018-05-15)
612
+++++++++++++++++++
7-
*To extend support for [Microsoft Audience Ads](https://docs.microsoft.com/en-us/bingads/guides/audience-ads), new bulk objects are added to the SDK for reading and writing Bulk file records e.g., BulkResponsiveAd and BulkResponsiveAdLabel.
13+
*To extend support for Microsoft Audience Ads, new bulk objects are added to the SDK for reading and writing Bulk file records e.g., BulkResponsiveAd and BulkResponsiveAdLabel.
814
*Added retries for the 117 throttling error if encountered while polling for the status of a bulk or reporting operation.
915
1016
---------------
1117
11.12.1(2018-04-12)
1218
+++++++++++++++++++
13-
*Added support for Bing Ads API Version 12. For more information, see [Migrating to Bing Ads API Version 12](https://docs.microsoft.com/en-us/bingads/guides/migration-guide).
19+
*Added support for Bing Ads API Version 12. For more information, see Migrating to Bing Ads API Version 12.
1420
*The version parameter is now required when creating each ServiceClient. Previously the version was optional and defaulted to version 11. The version parameter is moved to the second position between the service client name and the authorization data.
1521
*The file_type parameter now defaults to 'Csv' as an *str* datatype instead of the DownloadFileType for BulkFileReader, BulkServiceManager, DownloadParameters and SubmitDownloadParameters. You can set 'Tsv' if you prefer the tab separated file format type.
1622

1723
---------------
1824
11.5.9(2018-03-12)
1925
+++++++++++++++++++
20-
*Updated to support [Microsoft Account authentication in sandbox](https://docs.microsoft.com/en-us/bingads/guides/sandbox.md#access).
26+
*Updated to support Microsoft Account authentication in sandbox.
2127
2228
---------------
2329
11.5.8(2018-01-12)
2430
+++++++++++++++++++
25-
*The Bulk and Campaign Management proxies are updated to support [audience search size](https://docs.microsoft.com/en-us/bingads/guides/release-notes#audiencesearchsize-january2018). In addition the SDK supports audience search size via the BulkCustomAudience, BulkInMarketAudience, and BulkRemarketingList classes.
31+
*The Bulk and Campaign Management proxies are updated to support audience search size. In addition the SDK supports audience search size via the BulkCustomAudience, BulkInMarketAudience, and BulkRemarketingList classes.
2632
2733
*Allow the Parent Id to be empty when deleting Bulk entities. Previously the Parent Id was required by the SDK although the Bulk service does not always require it.
2834
2935
---------------
3036
11.5.7(2017-12-12)
3137
+++++++++++++++++++
3238

33-
*The Version 11 Reporting service proxies are updated to support new columns for [Estimated Bids](https://docs.microsoft.com/en-us/bingads/guides/release-notes#reporting-estimatedbids-november2017).
39+
*The Version 11 Reporting service proxies are updated to support new columns for Estimated Bids.
3440
3541
11.5.6(2017-11-01)
3642
+++++++++++++++++++
3743

3844
* Support for version 9 and 10 ended on October 31st, 2017. The following version 9 and 10 proxies are now removed from the SDK. You must upgrade to version 11.
3945
- Removed the Version 9 proxies for Customer Billing, Customer Management, and Reporting services. Also removed the Version 9 ReportingServiceManager.
4046
- Removed the Version 10 proxies for Ad Insight, Bulk, and Campaign Management services. Also removed the Version 10 BulkServiceManager and Version 10 Bulk entities.
41-
* The Version 11 Reporting service proxies are updated to support new columns for [Exact Match Impression Share Percent](https://docs.microsoft.com/en-us/bingads/guides/release-notes#reporting-exactmatchimpressionshare-october2017) and [Labels](https://docs.microsoft.com/en-us/bingads/guides/release-notes#reporting-labels-october2017).
47+
* The Version 11 Reporting service proxies are updated to support new columns for Exact Match Impression Share Percent and Labels.
4248
* Improved memory usage for decompressing the bulk and report files.
4349
* Set the default encoding to utf-8-sig and removed the chardet requirement. Bulk file download and upload should always be UTF-8 encoding with BOM.
4450

@@ -50,16 +56,16 @@ Release History
5056
11.5.5(2017-09-13)
5157
+++++++++++++++++++
5258

53-
* The [Reporting]( https://msdn.microsoft.com/library/bing-ads-overview-release-notes.aspx#reporting_locations_august2017) service proxies are updated to support new columns for location targeting.
59+
* The Reporting service proxies are updated to support new columns for location targeting.
5460

5561

5662
11.5.4(2017-08-08)
5763
+++++++++++++++++++
5864

59-
* The [Campaign Management]( https://msdn.microsoft.com/library/bing-ads-overview-release-notes.aspx#inheritedbidstrategytype_july2017) service proxies are updated to support inherited bid strategy type.
60-
* The [Reporting]( https://msdn.microsoft.com/library/bing-ads-overview-release-notes.aspx#reporting_bsc_july2017) service proxies are updated to support new columns for Bing Shopping campaigns.
61-
* New version 11 bulk labels objects are added i.e., *BulkLabel*, *BulkCampaignLabel*, *BulkAdGroupLabel*, *BulkKeywordLabel*, *BulkAppInstallAdLabel*, *BulkDynamicSearchAdLabel*, *BulkExpandedTextAdLabel*, *BulkProductAdLabel*, and *BulkTextAdLabel* objects are added to the SDK for reading and writing the corresponding [Bulk file records]( https://msdn.microsoft.com/library/bing-ads-overview-release-notes.aspx#bulk_v11_labels_july2017).
62-
* A new version 11 bulk offline conversion object is added i.e., the *BulkOfflineConversion* object is added to the SDK for writing and uploading the corresponding [Bulk file record]( https://msdn.microsoft.com/library/bing-ads-overview-release-notes.aspx#bulk_v11_offline_conversions_july2017).
65+
* The Campaign Management service proxies are updated to support inherited bid strategy type.
66+
* The Reporting service proxies are updated to support new columns for Bing Shopping campaigns.
67+
* New version 11 bulk labels objects are added i.e., *BulkLabel*, *BulkCampaignLabel*, *BulkAdGroupLabel*, *BulkKeywordLabel*, *BulkAppInstallAdLabel*, *BulkDynamicSearchAdLabel*, *BulkExpandedTextAdLabel*, *BulkProductAdLabel*, and *BulkTextAdLabel* objects are added to the SDK for reading and writing the corresponding Bulk file records.
68+
* A new version 11 bulk offline conversion object is added i.e., the *BulkOfflineConversion* object is added to the SDK for writing and uploading the corresponding Bulk file record.
6369

6470

6571
10.4.12(2017-02-28)

bingads/authorization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ def get_access_token(**kwargs):
625625
r.raise_for_status()
626626
except Exception:
627627
error_json = json.loads(r.text)
628-
raise OAuthTokenRequestException(error_json['error'], error_json['error_description'])
628+
raise OAuthTokenRequestException(error_json.get('error'), error_json.get('error_description'))
629629

630630
r_json = json.loads(r.text)
631631
return OAuthTokens(r_json['access_token'], int(r_json['expires_in']), r_json['refresh_token'])

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 = '11.12.2'
2+
VERSION = '11.12.3'
33
BULK_FORMAT_VERSION_5 = '5.0'
44
BULK_FORMAT_VERSION_6 = '6.0'
55
WORKING_NAME = 'BingAdsSDKPython'

bingads/v11/bulk/entities/bulk_account.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def __init__(self, account_id=None, customer_id=None, sync_time=None):
2323
self._id = account_id
2424
self._customer_id = customer_id
2525
self._sync_time = sync_time
26+
self._msclkid_auto_tagging_enabled = None
27+
self._tracking_url_template = None
2628

2729
@property
2830
def id(self):
@@ -60,6 +62,24 @@ def sync_time(self):
6062
"""
6163

6264
return self._sync_time
65+
66+
@property
67+
def msclkid_auto_tagging_enabled(self):
68+
""" Determines whether auto-tagging of the MSCLKID query string parameter is enabled. The MSCLKID is a 32-character GUID that is unique for each ad click.
69+
:return: The msclkid autotag setting of the account
70+
:rtype: bool
71+
"""
72+
return self._msclkid_auto_tagging_enabled
73+
74+
@property
75+
def tracking_url_template(self):
76+
""" The tracking template to use as a default for all URLs in your account.
77+
78+
:return: The tracking template of the account
79+
:rtype: str
80+
"""
81+
return self._tracking_url_template
82+
6383

6484
_MAPPINGS = [
6585
_SimpleBulkMapping(
@@ -77,6 +97,16 @@ def sync_time(self):
7797
field_to_csv=lambda c: bulk_datetime_str(c.sync_time),
7898
csv_to_field=lambda c, v: setattr(c, '_sync_time', parse_datetime(v) if v else None)
7999
),
100+
_SimpleBulkMapping(
101+
header=_StringTable.MSCLKIDAutoTaggingEnabled,
102+
field_to_csv=lambda c: bulk_str(c.msclkid_auto_tagging_enabled),
103+
csv_to_field=lambda c, v: setattr(c, '_msclkid_auto_tagging_enabled', parse_bool(v))
104+
),
105+
_SimpleBulkMapping(
106+
header=_StringTable.TrackingTemplate,
107+
field_to_csv=lambda c: bulk_str(c.tracking_url_template),
108+
csv_to_field=lambda c, v: setattr(c, '_tracking_url_template', v)
109+
),
80110
]
81111

82112
def process_mappings_from_row_values(self, row_values):

bingads/v11/bulk/entities/bulk_ad_group.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,34 @@ def performance_data(self):
238238
csv_to_field=lambda c, v: setattr(c.ad_group, 'PrivacyStatus', v if v else None)
239239
),
240240
_ComplexBulkMapping(bidding_scheme_to_csv, csv_to_bidding_scheme),
241-
241+
242242
_SimpleBulkMapping(
243243
header=_StringTable.TargetSetting,
244244
field_to_csv=lambda c: target_setting_to_csv(c.ad_group),
245245
csv_to_field=lambda c, v: csv_to_target_setting(c.ad_group, v)
246246
),
247+
247248
_SimpleBulkMapping(
248249
header=_StringTable.RemarketingTargetingSetting,
249250
field_to_csv=lambda c: bulk_str(c.ad_group.RemarketingTargetingSetting),
250251
csv_to_field=lambda c, v: setattr(c.ad_group, 'RemarketingTargetingSetting', v if v else None)
251252
),
253+
254+
_SimpleBulkMapping(
255+
header=_StringTable.BidOption,
256+
field_to_csv=lambda c: bid_option_to_csv(c.ad_group),
257+
csv_to_field=lambda c, v: csv_to_bid_option(c.ad_group, v)
258+
),
259+
_SimpleBulkMapping(
260+
header=_StringTable.BidBoostValue,
261+
field_to_csv=lambda c: bid_boost_value_to_csv(c.ad_group),
262+
csv_to_field=lambda c, v: csv_to_bid_boost_value(c.ad_group, v)
263+
),
264+
_SimpleBulkMapping(
265+
header=_StringTable.MaximumBid,
266+
field_to_csv=lambda c: maximum_bid_to_csv(c.ad_group),
267+
csv_to_field=lambda c, v: csv_to_maximum_bid(c.ad_group, v)
268+
),
252269
]
253270

254271
def process_mappings_from_row_values(self, row_values):

bingads/v11/internal/bulk/csv_headers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ class _CsvHeaders:
172172
_StringTable.CampaignType,
173173
_StringTable.CampaignPriority,
174174
_StringTable.LocalInventoryAdsEnabled,
175+
176+
#CoOp
177+
_StringTable.BidOption,
178+
_StringTable.BidBoostValue,
179+
_StringTable.MaximumBid,
175180

176181
# V10 added
177182
_StringTable.FieldPath,
@@ -317,7 +322,10 @@ class _CsvHeaders:
317322
_StringTable.ConversionName,
318323
_StringTable.ConversionTime,
319324
_StringTable.ConversionValue,
320-
_StringTable.MicrosoftClickId
325+
_StringTable.MicrosoftClickId,
326+
327+
# Account
328+
_StringTable.MSCLKIDAutoTaggingEnabled
321329

322330
]
323331

bingads/v11/internal/bulk/string_table.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class _StringTable:
6868
Account = "Account"
6969
SyncTime = "Sync Time"
7070
Name = "Name"
71+
MSCLKIDAutoTaggingEnabled = "MSCLKID Auto Tagging Enabled"
7172
LastModifiedTime = "Modified Time"
7273
AdFormatPreference = "Ad Format Preference"
7374

@@ -225,6 +226,11 @@ class _StringTable:
225226
CampaignType = "Campaign Type"
226227
CampaignPriority = "Priority"
227228
LocalInventoryAdsEnabled = "LocalInventoryAdsEnabled"
229+
230+
# CoOp
231+
BidOption = "Bid Option"
232+
BidBoostValue = "Bid Boost Value"
233+
MaximumBid = "Maximum Bid"
228234

229235
# V10 added
230236
FieldPath = "Field Path"

bingads/v11/internal/extensions.py

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
LocationIntentCriterion = _CAMPAIGN_OBJECT_FACTORY_V11.create('LocationIntentCriterion')
4141
RadiusCriterion = _CAMPAIGN_OBJECT_FACTORY_V11.create('RadiusCriterion')
4242
TargetSetting_Type = type(_CAMPAIGN_OBJECT_FACTORY_V11.create('TargetSetting'))
43+
CoOpSetting_Type = type(_CAMPAIGN_OBJECT_FACTORY_V11.create('CoOpSetting'))
4344

4445
def bulk_str(value):
4546
if value is None or (hasattr(value, 'value') and value.value is None):
@@ -438,7 +439,7 @@ def keyword_bid_bulk_str(value):
438439

439440
def parse_keyword_bid(value):
440441
bid = _CAMPAIGN_OBJECT_FACTORY_V11.create('Bid')
441-
if not value:
442+
if not value or value == DELETE_VALUE:
442443
bid.Amount = None
443444
else:
444445
bid.Amount = float(value)
@@ -1183,11 +1184,72 @@ def parse_rule_PageVisitors(rule_str):
11831184
rule.RuleItemGroups = parse_rule_groups(rule_str)
11841185
return rule
11851186

1187+
def maximum_bid_to_csv(ad_group):
1188+
if not ad_group.Settings or not ad_group.Settings.Setting:
1189+
return None
1190+
settings = [setting for setting in ad_group.Settings.Setting if isinstance(setting, CoOpSetting_Type)]
1191+
if len(settings) == 0:
1192+
return None
1193+
if len(settings) != 1:
1194+
raise ValueError('Can only have 1 CoOpSetting in AdGroup Settings.')
1195+
coop_setting = settings[0]
1196+
return coop_setting.BidMaxValue
1197+
1198+
def csv_to_maximum_bid(ad_group, value):
1199+
coop_setting = validate_coop_setting(ad_group)
1200+
coop_setting.BidMaxValue = float(value) if value else None
1201+
1202+
def bid_boost_value_to_csv(ad_group):
1203+
if not ad_group.Settings or not ad_group.Settings.Setting:
1204+
return None
1205+
settings = [setting for setting in ad_group.Settings.Setting if isinstance(setting, CoOpSetting_Type)]
1206+
if len(settings) == 0:
1207+
return None
1208+
if len(settings) != 1:
1209+
raise ValueError('Can only have 1 CoOpSetting in AdGroup Settings.')
1210+
coop_setting = settings[0]
1211+
return coop_setting.BidBoostValue
1212+
1213+
def csv_to_bid_boost_value(ad_group, value):
1214+
coop_setting = validate_coop_setting(ad_group)
1215+
coop_setting.BidBoostValue = float(value) if value else None
1216+
1217+
def bid_option_to_csv(ad_group):
1218+
if not ad_group.Settings or not ad_group.Settings.Setting:
1219+
return None
1220+
settings = [setting for setting in ad_group.Settings.Setting if isinstance(setting, CoOpSetting_Type)]
1221+
if len(settings) == 0:
1222+
return None
1223+
if len(settings) != 1:
1224+
raise ValueError('Can only have 1 CoOpSetting in AdGroup Settings.')
1225+
coop_setting = settings[0]
1226+
return coop_setting.BidOption
1227+
1228+
def csv_to_bid_option(ad_group, value):
1229+
coop_setting = validate_coop_setting(ad_group)
1230+
coop_setting.BidOption = value if value else None
1231+
1232+
def validate_coop_setting(ad_group):
1233+
settings = [setting for setting in ad_group.Settings.Setting if isinstance(setting, CoOpSetting_Type)]
1234+
if len(settings) == 0:
1235+
return create_coop_setting(ad_group)
1236+
1237+
if len(settings) > 1:
1238+
raise ValueError('Can only have 1 CoOpSetting in AdGroup Settings.')
1239+
return settings[0]
1240+
1241+
def create_coop_setting(ad_group):
1242+
coop_setting = _CAMPAIGN_OBJECT_FACTORY_V11.create('CoOpSetting')
1243+
coop_setting.Type = 'CoOpSetting'
1244+
ad_group.Settings.Setting.append(coop_setting)
1245+
return coop_setting
11861246

11871247
def target_setting_to_csv(ad_group):
11881248
if not ad_group.Settings or not ad_group.Settings.Setting:
11891249
return None
11901250
settings = [setting for setting in ad_group.Settings.Setting if isinstance(setting, TargetSetting_Type)]
1251+
if len(settings) == 0:
1252+
return None
11911253
if len(settings) != 1:
11921254
raise ValueError('Can only have 1 TargetSetting in AdGroup Settings.')
11931255
target_setting = settings[0]

bingads/v12/bulk/entities/bulk_account.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def __init__(self, account_id=None, customer_id=None, sync_time=None):
2323
self._id = account_id
2424
self._customer_id = customer_id
2525
self._sync_time = sync_time
26+
self._msclkid_auto_tagging_enabled = None
27+
self._tracking_url_template = None
2628

2729
@property
2830
def id(self):
@@ -61,6 +63,23 @@ def sync_time(self):
6163

6264
return self._sync_time
6365

66+
@property
67+
def msclkid_auto_tagging_enabled(self):
68+
""" Determines whether auto-tagging of the MSCLKID query string parameter is enabled. The MSCLKID is a 32-character GUID that is unique for each ad click.
69+
:return: The msclkid autotag setting of the account
70+
:rtype: bool
71+
"""
72+
return self._msclkid_auto_tagging_enabled
73+
74+
@property
75+
def tracking_url_template(self):
76+
""" The tracking template to use as a default for all URLs in your account.
77+
78+
:return: The tracking template of the account
79+
:rtype: str
80+
"""
81+
return self._tracking_url_template
82+
6483
_MAPPINGS = [
6584
_SimpleBulkMapping(
6685
header=_StringTable.Id,
@@ -77,6 +96,16 @@ def sync_time(self):
7796
field_to_csv=lambda c: bulk_datetime_str(c.sync_time),
7897
csv_to_field=lambda c, v: setattr(c, '_sync_time', parse_datetime(v) if v else None)
7998
),
99+
_SimpleBulkMapping(
100+
header=_StringTable.MSCLKIDAutoTaggingEnabled,
101+
field_to_csv=lambda c: bulk_str(c.msclkid_auto_tagging_enabled),
102+
csv_to_field=lambda c, v: setattr(c, '_msclkid_auto_tagging_enabled', parse_bool(v))
103+
),
104+
_SimpleBulkMapping(
105+
header=_StringTable.TrackingTemplate,
106+
field_to_csv=lambda c: bulk_str(c.tracking_url_template),
107+
csv_to_field=lambda c, v: setattr(c, '_tracking_url_template', v)
108+
),
80109
]
81110

82111
def process_mappings_from_row_values(self, row_values):

bingads/v12/bulk/entities/bulk_ad_group.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,21 @@ def performance_data(self):
216216
field_to_csv=lambda c: bulk_str(c.ad_group.PrivacyStatus),
217217
csv_to_field=lambda c, v: setattr(c.ad_group, 'PrivacyStatus', v if v else None)
218218
),
219+
_SimpleBulkMapping(
220+
header=_StringTable.BidOption,
221+
field_to_csv=lambda c: bid_option_to_csv(c.ad_group),
222+
csv_to_field=lambda c, v: csv_to_bid_option(c.ad_group, v)
223+
),
224+
_SimpleBulkMapping(
225+
header=_StringTable.BidBoostValue,
226+
field_to_csv=lambda c: bid_boost_value_to_csv(c.ad_group),
227+
csv_to_field=lambda c, v: csv_to_bid_boost_value(c.ad_group, v)
228+
),
229+
_SimpleBulkMapping(
230+
header=_StringTable.MaximumBid,
231+
field_to_csv=lambda c: maximum_bid_to_csv(c.ad_group),
232+
csv_to_field=lambda c, v: csv_to_maximum_bid(c.ad_group, v)
233+
),
219234
]
220235

221236
def process_mappings_from_row_values(self, row_values):

0 commit comments

Comments
 (0)