Skip to content

Commit

Permalink
update to version 13.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
qitia committed Aug 14, 2020
1 parent 97e3478 commit f63a8ae
Show file tree
Hide file tree
Showing 17 changed files with 691 additions and 54 deletions.
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
.. :changelog:
Release History
13.0.5(2020-08-14)
+++++++++++++++++++++++++
* Updated 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 BulkImage for bulk image upload.
* Add Multi-Image field mappings for BulkImageAdExtension.
* Add offline conversion adjustment field mappings for BulkOfflineConversion.
* Add bulk mappings for filter link ad extensions i.e., BulkFilterLinkAdExtension, BulkAccountFilterLinkAdExtension, BulkAdGroupFilterLinkAdExtension, and BulkCampaignFilterLinkAdExtension.

13.0.4.1(2020-07-23)
+++++++++++++++++++++++++
* Fix issue https://github.com/BingAds/BingAds-Python-SDK/issues/160.
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.4.1'
VERSION = '13.0.5'
BULK_FORMAT_VERSION_6 = '6.0'
WORKING_NAME = 'BingAdsSDKPython'
USER_AGENT = '{0} {1} {2}'.format(WORKING_NAME, VERSION, sys.version_info[0:3])
1 change: 1 addition & 0 deletions bingads/v13/bulk/entities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
from .labels import *
from .bulk_offline_conversion import *
from .bulk_experiment import *
from .bulk_image import *
from .feeds import *
3 changes: 2 additions & 1 deletion bingads/v13/bulk/entities/ad_extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
from .bulk_sitelink_ad_extensions import *
from .bulk_price_ad_extensions import *
from .bulk_action_ad_extensions import *
from .bulk_promotion_ad_extensions import *
from .bulk_promotion_ad_extensions import *
from .bulk_filterlink_ad_extensions import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v13.internal.bulk.string_table import _StringTable
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13

from bingads.v13.internal.extensions import *
from .common import _BulkAdExtensionBase
from .common import _BulkCampaignAdExtensionAssociation
from .common import _BulkAdGroupAdExtensionAssociation
from .common import _BulkAccountAdExtensionAssociation

_FilterLinkAdExtension = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('FilterLinkAdExtension'))


class BulkFilterLinkAdExtension(_BulkAdExtensionBase):
""" Represents a filter link ad extension.
This class exposes the :attr:`filter_link_ad_extension` property that can be read and written
as fields of the Filter Link Ad Extension record in a bulk file.
For more information, see Filter Link Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""

def __init__(self, account_id=None, ad_extension=None):
if ad_extension and not isinstance(ad_extension, _FilterLinkAdExtension):
raise ValueError('The type of ad_extension is: {0}, should be: {1}'.format(
type(ad_extension),
'FilterLinkAdExtension'
))
super(BulkFilterLinkAdExtension, self).__init__(
account_id=account_id,
ad_extension=ad_extension
)

@property
def filter_link_ad_extension(self):
""" The filter link ad extension.
see Filter Link Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
"""

return self._ad_extension

@filter_link_ad_extension.setter
def filter_link_ad_extension(self, value):
self._ad_extension = value

_MAPPINGS = [
_SimpleBulkMapping(
header=_StringTable.AdExtensionHeaderType,
field_to_csv=lambda c: bulk_str(c.filter_link_ad_extension.AdExtensionHeaderType),
csv_to_field=lambda c, v: setattr(c.filter_link_ad_extension, 'AdExtensionHeaderType', v)
),
_SimpleBulkMapping(
header=_StringTable.Language,
field_to_csv=lambda c: c.filter_link_ad_extension.Language,
csv_to_field=lambda c, v: setattr(c.filter_link_ad_extension, 'Language', v)
),
_SimpleBulkMapping(
header=_StringTable.Texts,
field_to_csv=lambda c: field_to_csv_delimited_strings(c.filter_link_ad_extension.Texts),
csv_to_field=lambda c, v: csv_to_field_delimited_strings(c.filter_link_ad_extension.Texts, v)
),
_SimpleBulkMapping(
header=_StringTable.TrackingTemplate,
field_to_csv=lambda c: bulk_str(c.filter_link_ad_extension.TrackingUrlTemplate),
csv_to_field=lambda c, v: setattr(c.filter_link_ad_extension, 'TrackingUrlTemplate', v if v else None)
),
_SimpleBulkMapping(
header=_StringTable.CustomParameter,
field_to_csv=lambda c: field_to_csv_UrlCustomParameters(c.filter_link_ad_extension),
csv_to_field=lambda c, v: csv_to_field_UrlCustomParameters(c.filter_link_ad_extension, v)
),
_SimpleBulkMapping(
header=_StringTable.FinalUrl,
field_to_csv=lambda c: field_to_csv_Urls(c.filter_link_ad_extension.FinalUrls, c.filter_link_ad_extension.Id),
csv_to_field=lambda c, v: csv_to_field_Urls(c.filter_link_ad_extension.FinalUrls, v)
),
_SimpleBulkMapping(
header=_StringTable.FinalMobileUrl,
field_to_csv=lambda c: field_to_csv_Urls(c.filter_link_ad_extension.FinalMobileUrls, c.filter_link_ad_extension.Id),
csv_to_field=lambda c, v: csv_to_field_Urls(c.filter_link_ad_extension.FinalMobileUrls, v)
)
]

def process_mappings_from_row_values(self, row_values):
self.filter_link_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V13.create('FilterLinkAdExtension')
self.filter_link_ad_extension.Type = 'FilterLinkAdExtension'
super(BulkFilterLinkAdExtension, self).process_mappings_from_row_values(row_values)
row_values.convert_to_entity(self, BulkFilterLinkAdExtension._MAPPINGS)

def process_mappings_to_row_values(self, row_values, exclude_readonly_data):
self._validate_property_not_null(self.filter_link_ad_extension, 'filter_link_ad_extension')
super(BulkFilterLinkAdExtension, self).process_mappings_to_row_values(row_values, exclude_readonly_data)
self.convert_to_values(row_values, BulkFilterLinkAdExtension._MAPPINGS)


class BulkAccountFilterLinkAdExtension(_BulkAccountAdExtensionAssociation):
""" Represents an account level filter link ad extension.
This class exposes properties that can be read and written
as fields of the Account Filter Link Ad Extension record in a bulk file.
For more information, see Account Filter Link Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""

pass


class BulkCampaignFilterLinkAdExtension(_BulkCampaignAdExtensionAssociation):
""" Represents a campaign level filter link ad extension.
This class exposes properties that can be read and written
as fields of the Campaign Filter Link Ad Extension record in a bulk file.
For more information, see Campaign Filter Link Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""

pass

class BulkAdGroupFilterLinkAdExtension(_BulkAdGroupAdExtensionAssociation):
""" Represents an ad group level filter link ad extension.
This class exposes properties that can be read and written
as fields of the Ad Group Filter Link Ad Extension record in a bulk file.
For more information, see Ad Group Filter Link Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""

pass
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,49 @@ def image_ad_extension(self, value):
),
_SimpleBulkMapping(
header=_StringTable.MediaIds,
#field_to_csv=lambda c: bulk_str(c.image_ad_extension.ImageMediaIds),
field_to_csv=lambda c: field_to_csv_MediaIds(c.image_ad_extension),
#csv_to_field=lambda c, v: setattr(c.image_ad_extension, 'ImageMediaIds', int(v))
csv_to_field=lambda c, v: csv_to_field_MediaIds(c.image_ad_extension, v)
),
_SimpleBulkMapping(
header=_StringTable.FinalUrlSuffix,
field_to_csv=lambda c: bulk_optional_str(c.image_ad_extension.FinalUrlSuffix, c.image_ad_extension.Id),
csv_to_field=lambda c, v: setattr(c.image_ad_extension, 'FinalUrlSuffix', v)
)
),
_SimpleBulkMapping(
header=_StringTable.TrackingTemplate,
field_to_csv=lambda c: bulk_str(c.image_ad_extension.TrackingUrlTemplate),
csv_to_field=lambda c, v: setattr(c.image_ad_extension, 'TrackingUrlTemplate', v if v else None)
),
_SimpleBulkMapping(
header=_StringTable.CustomParameter,
field_to_csv=lambda c: field_to_csv_UrlCustomParameters(c.image_ad_extension),
csv_to_field=lambda c, v: csv_to_field_UrlCustomParameters(c.image_ad_extension, v)
),
_SimpleBulkMapping(
header=_StringTable.FinalUrl,
field_to_csv=lambda c: field_to_csv_Urls(c.image_ad_extension.FinalUrls, c.image_ad_extension.Id),
csv_to_field=lambda c, v: csv_to_field_Urls(c.image_ad_extension.FinalUrls, v)
),
_SimpleBulkMapping(
header=_StringTable.FinalMobileUrl,
field_to_csv=lambda c: field_to_csv_Urls(c.image_ad_extension.FinalMobileUrls, c.image_ad_extension.Id),
csv_to_field=lambda c, v: csv_to_field_Urls(c.image_ad_extension.FinalMobileUrls, v)
),
_SimpleBulkMapping(
header=_StringTable.DisplayText,
field_to_csv=lambda c: bulk_optional_str(c.image_ad_extension.DisplayText, c.image_ad_extension.Id),
csv_to_field=lambda c, v: setattr(c.image_ad_extension, 'DisplayText', v if v else '')
),
_SimpleBulkMapping(
header=_StringTable.Layouts,
field_to_csv=lambda c: field_to_csv_delimited_strings(c.image_ad_extension.Layouts),
csv_to_field=lambda c, v: csv_to_field_delimited_strings(c.image_ad_extension.Layouts, v)
),
_SimpleBulkMapping(
header=_StringTable.Images,
field_to_csv=lambda c: field_to_csv_ImageAssetLinks(c.image_ad_extension.Images),
csv_to_field=lambda c, v: csv_to_field_ImageAssetLinks(c.image_ad_extension.Images, v)
),
]

def process_mappings_from_row_values(self, row_values):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def structured_snippet_ad_extension(self, value):
),
_SimpleBulkMapping(
header=_StringTable.StructuredSnippetValues,
field_to_csv=lambda c: field_to_csv_StructuredSnippetValues(c.structured_snippet_ad_extension),
csv_to_field=lambda c, v: csv_to_field_StructuredSnippetValues(c.structured_snippet_ad_extension, v)
field_to_csv=lambda c: field_to_csv_delimited_strings(c.structured_snippet_ad_extension.Values),
csv_to_field=lambda c, v: csv_to_field_delimited_strings(c.structured_snippet_ad_extension.Values, v)
),
]

Expand Down
Loading

0 comments on commit f63a8ae

Please sign in to comment.