Skip to content

Commit

Permalink
update to version 11.12.5
Browse files Browse the repository at this point in the history
  • Loading branch information
qitia committed Aug 8, 2018
1 parent 06c2125 commit 07a309a
Show file tree
Hide file tree
Showing 19 changed files with 347 additions and 177 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Release History
-----------

11.12.5(2018-08-10)
*Updated service proxies to support customer address, campaign level profile criteria, similar audiences for remarketing lists, and new change history report columns. For details see the service release notes: https://docs.microsoft.com/en-us/bingads/guides/release-notes?view=bingads-12#august2018.
*Added BulkEntity mappings for campaign level profile criteria i.e., added BulkCampaignCompanyNameCriterion, BulkCampaignJobFunctionCriterion, and BulkCampaignIndustryCriterion.
11.12.4(2018-07-10)
* Added a mapping for the Domain column in the Bulk file to the BulkExpandedTextAd object.
* Limited the scope to bingads.manage for access token requests. Previously the default scope was used, which can vary if a user granted your app permissions to multiple scopes. The Bing Ads SDKs only support the bingads.manage scope.
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 = '11.12.4'
VERSION = '11.12.5'
BULK_FORMAT_VERSION_5 = '5.0'
BULK_FORMAT_VERSION_6 = '6.0'
WORKING_NAME = 'BingAdsSDKPython'
Expand Down
44 changes: 29 additions & 15 deletions bingads/v11/bulk/entities/bulk_ad_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,34 @@
from bingads.v11.internal.extensions import *


def coop_setting_to_csv(bulk_ad_group, row_values):
if not bulk_ad_group.ad_group.Settings or not bulk_ad_group.ad_group.Settings.Setting:
return
settings = [setting for setting in bulk_ad_group.ad_group.Settings.Setting if isinstance(setting, CoOpSetting_Type)]
if len(settings) == 0:
return
if len(settings) != 1:
raise ValueError('Can only have 1 CoOpSetting in AdGroup Settings.')

row_values[_StringTable.MaximumBid] = settings[0].BidMaxValue
row_values[_StringTable.BidBoostValue] = settings[0].BidBoostValue
row_values[_StringTable.BidOption] = settings[0].BidOption
pass

def csv_to_coop_setting(row_values, bulk_ad_group):
maximum_bid_success, maximum_bid = row_values.try_get_value(_StringTable.MaximumBid)
bid_boost_value_success, bid_boost_value = row_values.try_get_value(_StringTable.BidBoostValue)
bid_option_success, bid_option = row_values.try_get_value(_StringTable.BidOption)

if maximum_bid_success or bid_boost_value_success or bid_option_success:
coop_setting = _CAMPAIGN_OBJECT_FACTORY_V11.create('CoOpSetting')
coop_setting.Type = 'CoOpSetting'
coop_setting.BidOption = bid_option if bid_option else None
coop_setting.BidBoostValue = float(bid_boost_value) if bid_boost_value else None
coop_setting.BidMaxValue = float(maximum_bid) if maximum_bid else None
bulk_ad_group.ad_group.Settings.Setting.append(coop_setting)
pass

def bidding_scheme_to_csv(bulk_ad_group, row_values):
bid_strategy_type = field_to_csv_BidStrategyType(bulk_ad_group.ad_group)
if not bid_strategy_type:
Expand Down Expand Up @@ -251,21 +279,7 @@ def performance_data(self):
csv_to_field=lambda c, v: setattr(c.ad_group, 'RemarketingTargetingSetting', v if v else None)
),

_SimpleBulkMapping(
header=_StringTable.BidOption,
field_to_csv=lambda c: bid_option_to_csv(c.ad_group),
csv_to_field=lambda c, v: csv_to_bid_option(c.ad_group, v)
),
_SimpleBulkMapping(
header=_StringTable.BidBoostValue,
field_to_csv=lambda c: bid_boost_value_to_csv(c.ad_group),
csv_to_field=lambda c, v: csv_to_bid_boost_value(c.ad_group, v)
),
_SimpleBulkMapping(
header=_StringTable.MaximumBid,
field_to_csv=lambda c: maximum_bid_to_csv(c.ad_group),
csv_to_field=lambda c, v: csv_to_maximum_bid(c.ad_group, v)
),
_ComplexBulkMapping(coop_setting_to_csv, csv_to_coop_setting),
]

def process_mappings_from_row_values(self, row_values):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
from abc import ABCMeta, abstractmethod

class BulkAdGroupNegativeProfileCriterion(_SingleRecordBulkEntity):
""" Represents an Ad Group Negative Profile Criterion that can be read or written in a bulk file.
""" The base class for Ad group level negative profile criterion that can be read or written in a bulk file.
This class exposes the :attr:`negative_ad_group_criterion` property that can be read and written as fields of the
Ad Group Negative Profile Criterion record in a bulk file.
This class exposes the :attr:`negative_ad_group_criterion` property that can be read and written in a bulk file.
For more information, see Ad Group Negative Profile Criterion at https://go.microsoft.com/fwlink/?linkid=846127.
For more information, see Bulk File Schema at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
from abc import ABCMeta, abstractmethod

class BulkAdGroupProfileCriterion(_SingleRecordBulkEntity):
""" Represents an Ad Group Profile Criterion that can be read or written in a bulk file.
""" The base class for Ad group level profile 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 Profile Criterion record in a bulk file.
This class exposes the :attr:`biddable_ad_group_criterion` property that can be read and written in a bulk file.
For more information, see Ad Group Profile Criterion at https://go.microsoft.com/fwlink/?linkid=846127.
For more information, see Bulk File Schema at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
Expand Down
1 change: 0 additions & 1 deletion bingads/v11/internal/bulk/csv_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class _CsvHeaders:
_StringTable.BudgetType,
_StringTable.BudgetName,
_StringTable.BudgetId,
_StringTable.KeywordVariantMatchEnabled,

# AdGroup
_StringTable.StartDate,
Expand Down
1 change: 0 additions & 1 deletion bingads/v11/internal/bulk/string_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class _StringTable:
BudgetType = "Budget Type"
BudgetName = "Budget Name"
BudgetId = "Budget Id"
KeywordVariantMatchEnabled = "KeywordVariantMatchEnabled"
AdGroup = "Ad Group"
Keyword = "Keyword"
TextAd = "Text Ad"
Expand Down
60 changes: 0 additions & 60 deletions bingads/v11/internal/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,66 +1184,6 @@ def parse_rule_PageVisitors(rule_str):
rule.RuleItemGroups = parse_rule_groups(rule_str)
return rule

def maximum_bid_to_csv(ad_group):
if not ad_group.Settings or not ad_group.Settings.Setting:
return None
settings = [setting for setting in ad_group.Settings.Setting if isinstance(setting, CoOpSetting_Type)]
if len(settings) == 0:
return None
if len(settings) != 1:
raise ValueError('Can only have 1 CoOpSetting in AdGroup Settings.')
coop_setting = settings[0]
return coop_setting.BidMaxValue

def csv_to_maximum_bid(ad_group, value):
coop_setting = validate_coop_setting(ad_group)
coop_setting.BidMaxValue = float(value) if value else None

def bid_boost_value_to_csv(ad_group):
if not ad_group.Settings or not ad_group.Settings.Setting:
return None
settings = [setting for setting in ad_group.Settings.Setting if isinstance(setting, CoOpSetting_Type)]
if len(settings) == 0:
return None
if len(settings) != 1:
raise ValueError('Can only have 1 CoOpSetting in AdGroup Settings.')
coop_setting = settings[0]
return coop_setting.BidBoostValue

def csv_to_bid_boost_value(ad_group, value):
coop_setting = validate_coop_setting(ad_group)
coop_setting.BidBoostValue = float(value) if value else None

def bid_option_to_csv(ad_group):
if not ad_group.Settings or not ad_group.Settings.Setting:
return None
settings = [setting for setting in ad_group.Settings.Setting if isinstance(setting, CoOpSetting_Type)]
if len(settings) == 0:
return None
if len(settings) != 1:
raise ValueError('Can only have 1 CoOpSetting in AdGroup Settings.')
coop_setting = settings[0]
return coop_setting.BidOption

def csv_to_bid_option(ad_group, value):
coop_setting = validate_coop_setting(ad_group)
coop_setting.BidOption = value if value else None

def validate_coop_setting(ad_group):
settings = [setting for setting in ad_group.Settings.Setting if isinstance(setting, CoOpSetting_Type)]
if len(settings) == 0:
return create_coop_setting(ad_group)

if len(settings) > 1:
raise ValueError('Can only have 1 CoOpSetting in AdGroup Settings.')
return settings[0]

def create_coop_setting(ad_group):
coop_setting = _CAMPAIGN_OBJECT_FACTORY_V11.create('CoOpSetting')
coop_setting.Type = 'CoOpSetting'
ad_group.Settings.Setting.append(coop_setting)
return coop_setting

def target_setting_to_csv(ad_group):
if not ad_group.Settings or not ad_group.Settings.Setting:
return None
Expand Down
9 changes: 8 additions & 1 deletion bingads/v11/proxies/campaign_management_service.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,13 @@
<xs:enumeration value="None" />
<xs:enumeration value="TrackingUrlTemplate" />
<xs:enumeration value="MSCLKIDAutoTaggingEnabled" />
<xs:enumeration value="AdClickParallelTracking">
<xs:annotation>
<xs:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">4</EnumerationValue>
</xs:appinfo>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:element name="AccountPropertyName" nillable="true" type="tns:AccountPropertyName" />
Expand Down Expand Up @@ -9982,7 +9989,7 @@
</wsdl:binding>
<wsdl:service name="CampaignManagementService">
<wsdl:port name="BasicHttpBinding_ICampaignManagementService" binding="tns:BasicHttpBinding_ICampaignManagementService">
<soap:address location="https://campaign.api.sandbox.bingads.microsoft.com/Api/Advertiser/CampaignManagement/V11/CampaignManagementService.svc" />
<soap:address location="https://campaign.api.sandbox.bingads.microsoft.com/Api/Advertiser/CampaignManagement/v11/CampaignManagementService.svc" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
45 changes: 30 additions & 15 deletions bingads/v12/bulk/entities/bulk_ad_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,34 @@
from bingads.v12.internal.bulk.mappings import _SimpleBulkMapping, _ComplexBulkMapping
from bingads.v12.internal.extensions import *

def coop_setting_to_csv(bulk_ad_group, row_values):
if not bulk_ad_group.ad_group.Settings or not bulk_ad_group.ad_group.Settings.Setting:
return
settings = [setting for setting in bulk_ad_group.ad_group.Settings.Setting if isinstance(setting, CoOpSetting_Type)]
if len(settings) == 0:
return
if len(settings) != 1:
raise ValueError('Can only have 1 CoOpSetting in AdGroup Settings.')

row_values[_StringTable.MaximumBid] = settings[0].BidMaxValue
row_values[_StringTable.BidBoostValue] = settings[0].BidBoostValue
row_values[_StringTable.BidOption] = settings[0].BidOption
pass

def csv_to_coop_setting(row_values, bulk_ad_group):
maximum_bid_success, maximum_bid = row_values.try_get_value(_StringTable.MaximumBid)
bid_boost_value_success, bid_boost_value = row_values.try_get_value(_StringTable.BidBoostValue)
bid_option_success, bid_option = row_values.try_get_value(_StringTable.BidOption)

if maximum_bid_success or bid_boost_value_success or bid_option_success:
coop_setting = _CAMPAIGN_OBJECT_FACTORY_V12.create('CoOpSetting')
coop_setting.Type = 'CoOpSetting'
coop_setting.BidOption = bid_option if bid_option else None
coop_setting.BidBoostValue = float(bid_boost_value) if bid_boost_value else None
coop_setting.BidMaxValue = float(maximum_bid) if maximum_bid else None
bulk_ad_group.ad_group.Settings.Setting.append(coop_setting)
pass

def bidding_scheme_to_csv(bulk_ad_group, row_values):
bid_strategy_type = field_to_csv_BidStrategyType(bulk_ad_group.ad_group)
if not bid_strategy_type:
Expand Down Expand Up @@ -216,21 +244,8 @@ def performance_data(self):
field_to_csv=lambda c: bulk_str(c.ad_group.PrivacyStatus),
csv_to_field=lambda c, v: setattr(c.ad_group, 'PrivacyStatus', v if v else None)
),
_SimpleBulkMapping(
header=_StringTable.BidOption,
field_to_csv=lambda c: bid_option_to_csv(c.ad_group),
csv_to_field=lambda c, v: csv_to_bid_option(c.ad_group, v)
),
_SimpleBulkMapping(
header=_StringTable.BidBoostValue,
field_to_csv=lambda c: bid_boost_value_to_csv(c.ad_group),
csv_to_field=lambda c, v: csv_to_bid_boost_value(c.ad_group, v)
),
_SimpleBulkMapping(
header=_StringTable.MaximumBid,
field_to_csv=lambda c: maximum_bid_to_csv(c.ad_group),
csv_to_field=lambda c, v: csv_to_maximum_bid(c.ad_group, v)
),

_ComplexBulkMapping(coop_setting_to_csv, csv_to_coop_setting),
]

def process_mappings_from_row_values(self, row_values):
Expand Down
1 change: 1 addition & 0 deletions bingads/v12/bulk/entities/target_criterions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
from .bulk_campaign_location_intent_criterion import *
from .bulk_campaign_negative_location_criterion import *
from .bulk_campaign_radius_criterion import *
from .bulk_campaign_profile_criterion import *
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
from abc import ABCMeta, abstractmethod

class BulkAdGroupProfileCriterion(_SingleRecordBulkEntity):
""" Represents an Ad Group Profile Criterion that can be read or written in a bulk file.
""" The base class for Ad Group level profile 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 Profile Criterion record in a bulk file.
This class exposes the :attr:`biddable_ad_group_criterion` property that can be read and written in a bulk file.
For more information, see Ad Group Profile Criterion at https://go.microsoft.com/fwlink/?linkid=846127.
For more information, see Bulk File Schema at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
Expand Down
Loading

0 comments on commit 07a309a

Please sign in to comment.