Skip to content

Commit

Permalink
update version to v12.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
qitia committed Mar 19, 2019
1 parent 205ebf9 commit d3915e2
Show file tree
Hide file tree
Showing 22 changed files with 288 additions and 107 deletions.
9 changes: 9 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Release History
-----------
12.0.4(2019-03-15)
+++++++++++++++++++
* Updated 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.
* Added a new Bulk property for Action Text i.e., added ActionText to the existing BulkActionAdExtension.
* Removed the is_expired property from BulkAdGroup. Use the Status property of the BulkAdGroup instead.
* For optional fields, the Bulk file schema mapping is updated such that "delete_value" will only be written to the file for update operations. Update intent is assumed when the Bulk entity ID is greater than zero.
* Updated the Status mapping for BulkExperiment i.e., map the string value directly instead of via bulk_optional_str.


12.0.3.1(2019-02-01)
+++++++++++++++++++
* Fix import issue introduced by version 12.0.3, in which version python 3 users will see error "ImportError: No module named 'bulk_ad_group_negative_audience_association". See issue: https://github.com/BingAds/BingAds-Python-SDK/issues/110.
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include *.rst *.py *.txt
include *.rst *.py *.txt
include LICENSE

include bingads/v12/proxies/*xml
include bingads/v12/proxies/*xml
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 = '12.0.3.1'
VERSION = '12.0.4'
BULK_FORMAT_VERSION_5 = '5.0'
BULK_FORMAT_VERSION_6 = '6.0'
WORKING_NAME = 'BingAdsSDKPython'
Expand Down
12 changes: 4 additions & 8 deletions bingads/service_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from suds.client import Client, Factory, WebFault, ObjectCache # noqa
from suds.client import Client, Factory, WebFault, ObjectCache # noqa

from .headerplugin import HeaderPlugin
from .authorization import *
Expand Down Expand Up @@ -197,10 +197,8 @@ def _format_version(version):
:return: int version
"""
if version == 'v12' or version == 12:
version = 12
else:
raise ValueError(str.format('version error: [{0}] is not supported. Please specify V11 or V12', version))
return version
return 12
raise ValueError(str.format('version error: [{0}] is not supported.', version))


@staticmethod
Expand Down Expand Up @@ -295,10 +293,8 @@ def name(self):


_CAMPAIGN_MANAGEMENT_SERVICE_V12 = Client(
'file:///' + pkg_resources.resource_filename('bingads', 'v12/proxies/campaign_management_service.xml')
)
'file:///' + pkg_resources.resource_filename('bingads', 'v12/proxies/campaign_management_service.xml'))
_CAMPAIGN_OBJECT_FACTORY_V12 = _CAMPAIGN_MANAGEMENT_SERVICE_V12.factory
# TODO Better to push suds-jurko accept this caching
_CAMPAIGN_OBJECT_FACTORY_V12.object_cache = {}
_CAMPAIGN_OBJECT_FACTORY_V12.create_without_cache = _CAMPAIGN_OBJECT_FACTORY_V12.create

Expand Down
6 changes: 3 additions & 3 deletions bingads/v12/bulk/bulk_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class BulkOperation(object):
def __init__(self,
request_id,
authorization_data,
poll_interval_in_milliseconds=15000,
poll_interval_in_milliseconds=5000,
environment='production',
tracking_id=None,
**suds_options):
Expand Down Expand Up @@ -191,7 +191,7 @@ class BulkDownloadOperation(BulkOperation):
def __init__(self,
request_id,
authorization_data,
poll_interval_in_milliseconds=15000,
poll_interval_in_milliseconds=5000,
environment='production',
tracking_id=None,
**suds_options):
Expand Down Expand Up @@ -290,7 +290,7 @@ class BulkUploadOperation(BulkOperation):
def __init__(self,
request_id,
authorization_data,
poll_interval_in_milliseconds=15000,
poll_interval_in_milliseconds=5000,
environment='production',
tracking_id=None,
**suds_options):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def __init__(self, account_id=None, ad_extension=None):
account_id=account_id,
ad_extension=ad_extension
)
self._action_text = None


@property
def action_ad_extension(self):
Expand All @@ -52,6 +54,19 @@ def action_ad_extension(self):
@action_ad_extension.setter
def action_ad_extension(self, value):
self._ad_extension = value


@property
def action_text(self):
""" The action text.
"""

return self._action_text

@action_text.setter
def action_text(self, value):
self._action_text = value

_MAPPINGS = [
_SimpleBulkMapping(
Expand All @@ -61,29 +76,34 @@ def action_ad_extension(self, value):
),
_SimpleBulkMapping(
header=_StringTable.FinalUrl,
field_to_csv=lambda c: field_to_csv_Urls(c.action_ad_extension.FinalUrls),
field_to_csv=lambda c: field_to_csv_Urls(c.action_ad_extension.FinalUrls, c.action_ad_extension.Id),
csv_to_field=lambda c, v: csv_to_field_Urls(c.action_ad_extension.FinalUrls, v)
),
_SimpleBulkMapping(
header=_StringTable.FinalMobileUrl,
field_to_csv=lambda c: field_to_csv_Urls(c.action_ad_extension.FinalMobileUrls),
field_to_csv=lambda c: field_to_csv_Urls(c.action_ad_extension.FinalMobileUrls, c.action_ad_extension.Id),
csv_to_field=lambda c, v: csv_to_field_Urls(c.action_ad_extension.FinalMobileUrls, v)
),
_SimpleBulkMapping(
header=_StringTable.TrackingTemplate,
field_to_csv=lambda c: bulk_optional_str(c.action_ad_extension.TrackingUrlTemplate),
field_to_csv=lambda c: bulk_optional_str(c.action_ad_extension.TrackingUrlTemplate, c.action_ad_extension.Id),
csv_to_field=lambda c, v: setattr(c.action_ad_extension, 'TrackingUrlTemplate', v if v else '')
),
_SimpleBulkMapping(
header=_StringTable.Language,
field_to_csv=lambda c: bulk_optional_str(c.action_ad_extension.Language),
field_to_csv=lambda c: bulk_optional_str(c.action_ad_extension.Language, c.action_ad_extension.Id),
csv_to_field=lambda c, v: setattr(c.action_ad_extension, 'Language', v if v else '')
),
_SimpleBulkMapping(
header=_StringTable.CustomParameter,
field_to_csv=lambda c: field_to_csv_UrlCustomParameters(c.action_ad_extension),
csv_to_field=lambda c, v: csv_to_field_UrlCustomParameters(c.action_ad_extension, v)
)
),
_SimpleBulkMapping(
header=_StringTable.ActionText,
field_to_csv=lambda c: c.action_text,
csv_to_field=lambda c, v: setattr(c, 'action_text', v)
),
]

def process_mappings_from_row_values(self, row_values):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def image_ad_extension(self, value):
_MAPPINGS = [
_SimpleBulkMapping(
header=_StringTable.DestinationUrl,
field_to_csv=lambda c: bulk_optional_str(c.image_ad_extension.DestinationUrl),
field_to_csv=lambda c: bulk_optional_str(c.image_ad_extension.DestinationUrl, c.image_ad_extension.Id),
csv_to_field=lambda c, v: setattr(c.image_ad_extension, 'DestinationUrl', v if v else '')
),
_SimpleBulkMapping(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def location_ad_extension(self, value):
),
_SimpleBulkMapping(
header=_StringTable.PhoneNumber,
field_to_csv=lambda c: bulk_optional_str(c.location_ad_extension.PhoneNumber),
field_to_csv=lambda c: bulk_optional_str(c.location_ad_extension.PhoneNumber, c.location_ad_extension.Id),
csv_to_field=lambda c, v: setattr(c.location_ad_extension, 'PhoneNumber', v if v else '')
),
_SimpleBulkMapping(
Expand All @@ -81,7 +81,7 @@ def location_ad_extension(self, value):
header=_StringTable.AddressLine2,
field_to_csv=lambda c: BulkLocationAdExtension.get_address_part(
c,
lambda x: bulk_optional_str(x.StreetAddress2)
lambda x: bulk_optional_str(x.StreetAddress2, c.location_ad_extension.Id)
),
csv_to_field=lambda c, v: BulkLocationAdExtension.set_address_part(
c,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def sitelink_ad_extension(self, value):
),
_SimpleBulkMapping(
header=_StringTable.DestinationUrl,
field_to_csv=lambda c: bulk_optional_str(c.sitelink_ad_extension.DestinationUrl),
field_to_csv=lambda c: bulk_optional_str(c.sitelink_ad_extension.DestinationUrl, c.sitelink_ad_extension.Id),
csv_to_field=lambda c, v: setattr(c.sitelink_ad_extension, 'DestinationUrl', v if v else '')
),
_SimpleBulkMapping(
Expand All @@ -75,12 +75,12 @@ def sitelink_ad_extension(self, value):
),
_SimpleBulkMapping(
header=_StringTable.FinalUrl,
field_to_csv=lambda c: field_to_csv_Urls(c.sitelink_ad_extension.FinalUrls),
field_to_csv=lambda c: field_to_csv_Urls(c.sitelink_ad_extension.FinalUrls, c.sitelink_ad_extension.Id),
csv_to_field=lambda c, v: csv_to_field_Urls(c.sitelink_ad_extension.FinalUrls, v)
),
_SimpleBulkMapping(
header=_StringTable.FinalMobileUrl,
field_to_csv=lambda c: field_to_csv_Urls(c.sitelink_ad_extension.FinalMobileUrls),
field_to_csv=lambda c: field_to_csv_Urls(c.sitelink_ad_extension.FinalMobileUrls, c.sitelink_ad_extension.Id),
csv_to_field=lambda c, v: csv_to_field_Urls(c.sitelink_ad_extension.FinalMobileUrls, v)
),
_SimpleBulkMapping(
Expand Down
8 changes: 4 additions & 4 deletions bingads/v12/bulk/entities/ad_extensions/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ def account_id(self, account_id):
),
_SimpleBulkMapping(
header=_StringTable.StartDate,
field_to_csv=lambda c: field_to_csv_SchedulingStartDate(c._ad_extension.Scheduling),
field_to_csv=lambda c: field_to_csv_SchedulingStartDate(c._ad_extension.Scheduling, c._ad_extension.Id),
csv_to_field=lambda c, v: csv_to_field_Date(c._ad_extension.Scheduling, 'StartDate', v)
),
_SimpleBulkMapping(
header=_StringTable.EndDate,
field_to_csv=lambda c: field_to_csv_SchedulingEndDate(c._ad_extension.Scheduling),
field_to_csv=lambda c: field_to_csv_SchedulingEndDate(c._ad_extension.Scheduling, c._ad_extension.Id),
csv_to_field = lambda c, v: csv_to_field_Date(c._ad_extension.Scheduling, 'EndDate', v)
),
_SimpleBulkMapping(
header=_StringTable.AdSchedule,
field_to_csv=lambda c: field_to_csv_AdSchedule(c._ad_extension.Scheduling),
field_to_csv=lambda c: field_to_csv_AdSchedule(c._ad_extension.Scheduling, c._ad_extension.Id),
csv_to_field=lambda c, v: csv_to_field_AdSchedule(c._ad_extension.Scheduling, v)
),
_SimpleBulkMapping(
header=_StringTable.UseSearcherTimeZone,
field_to_csv=lambda c: field_to_csv_UseSearcherTimeZone(c._ad_extension.Scheduling),
field_to_csv=lambda c: field_to_csv_UseSearcherTimeZone(c._ad_extension.Scheduling, c._ad_extension.Id),
csv_to_field=lambda c, v: setattr(c._ad_extension.Scheduling, 'UseSearcherTimeZone', parse_bool(v))
),
_SimpleBulkMapping(
Expand Down
14 changes: 2 additions & 12 deletions bingads/v12/bulk/entities/bulk_ad_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def __init__(self, campaign_id=None, campaign_name=None, ad_group=None):
self._campaign_name = campaign_name
self._ad_group = ad_group

self._is_expired = None
self._quality_score_data = None
self._performance_data = None

Expand Down Expand Up @@ -131,15 +130,6 @@ def ad_group(self):
def ad_group(self, ad_group):
self._ad_group = ad_group

@property
def is_expired(self):
""" Indicates whether the AdGroup is expired.
:rtype: bool
"""

return self._is_expired

@property
def quality_score_data(self):
""" The quality score data for the ad group.
Expand All @@ -165,7 +155,7 @@ def performance_data(self):
),
_SimpleBulkMapping(
header=_StringTable.Status,
field_to_csv=lambda c: 'Expired' if c.is_expired else bulk_str(c.ad_group.Status),
field_to_csv=lambda c: bulk_str(c.ad_group.Status),
csv_to_field=csv_to_status
),
_SimpleBulkMapping(
Expand Down Expand Up @@ -200,7 +190,7 @@ def performance_data(self):
),
_SimpleBulkMapping(
header=_StringTable.AdRotation,
field_to_csv=lambda c: ad_rotation_bulk_str(c.ad_group.AdRotation),
field_to_csv=lambda c: ad_rotation_bulk_str(c.ad_group.AdRotation, c.ad_group.Id),
csv_to_field=lambda c, v: setattr(c.ad_group, 'AdRotation', parse_ad_rotation(v))
),
_SimpleBulkMapping(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self,
),
_SimpleBulkMapping(
header=_StringTable.TrackingTemplate,
field_to_csv=lambda c: bulk_optional_str(c.biddable_ad_group_criterion.TrackingUrlTemplate),
field_to_csv=lambda c: bulk_optional_str(c.biddable_ad_group_criterion.TrackingUrlTemplate, c.biddable_ad_group_criterion.Id),
csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'TrackingUrlTemplate', v if v else None)
),
_SimpleBulkMapping(
Expand Down
6 changes: 3 additions & 3 deletions bingads/v12/bulk/entities/bulk_ad_group_product_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,21 @@ def _read_destination_url(cls, entity, row_value):
),
_SimpleBulkMapping(
header=_StringTable.FinalUrl,
field_to_csv=lambda c: field_to_csv_Urls(c.ad_group_criterion.FinalUrls)
field_to_csv=lambda c: field_to_csv_Urls(c.ad_group_criterion.FinalUrls, c.ad_group_criterion.Id)
if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None,
csv_to_field=lambda c, v: csv_to_field_Urls(c.ad_group_criterion.FinalUrls, v)
if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None
),
_SimpleBulkMapping(
header=_StringTable.FinalMobileUrl,
field_to_csv=lambda c: field_to_csv_Urls(c.ad_group_criterion.FinalMobileUrls)
field_to_csv=lambda c: field_to_csv_Urls(c.ad_group_criterion.FinalMobileUrls, c.ad_group_criterion.Id)
if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None,
csv_to_field=lambda c, v: csv_to_field_Urls(c.ad_group_criterion.FinalMobileUrls, v)
if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None
),
_SimpleBulkMapping(
header=_StringTable.TrackingTemplate,
field_to_csv=lambda c: bulk_optional_str(c.ad_group_criterion.TrackingUrlTemplate)
field_to_csv=lambda c: bulk_optional_str(c.ad_group_criterion.TrackingUrlTemplate, c.ad_group_criterion.Id)
if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None,
csv_to_field=lambda c, v: setattr(c.ad_group_criterion, 'TrackingUrlTemplate', v if v else None)
if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None
Expand Down
Loading

0 comments on commit d3915e2

Please sign in to comment.