Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def process_mappings_from_row_values(self, row_values):
self.price_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V12.create('PriceAdExtension')
self.price_ad_extension.Type = 'PriceAdExtension'
super(BulkPriceAdExtension, self).process_mappings_from_row_values(row_values)
row_values.convert_to_entity(self, BulkPriceAdExtension._MAPPINGS)
def process_mappings_from_row_values(self, row_values):
self._biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('BiddableAdGroupCriterion')
self._biddable_ad_group_criterion.Type = 'BiddableAdGroupCriterion'
self._biddable_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('Webpage')
self._biddable_ad_group_criterion.Criterion.Type = 'Webpage'
self._biddable_ad_group_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY_V12.create('FixedBid')
self._biddable_ad_group_criterion.CriterionBid.Type = 'FixedBid'
row_values.convert_to_entity(self, BulkAdGroupDynamicSearchAdTarget._MAPPINGS)
self._performance_data = PerformanceData.read_from_row_values_or_null(row_values)
from bingads.v12.internal.bulk.mappings import _SimpleBulkMapping, _ComplexBulkMapping
from bingads.v12.internal.bulk.string_table import _StringTable
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V12
from .common import _BulkAdExtensionBase
from .common import _BulkAdGroupAdExtensionAssociation
from .common import _BulkCampaignAdExtensionAssociation
from .common import _BulkAccountAdExtensionAssociation
from bingads.v12.internal.extensions import *
_PriceAdExtension = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('PriceAdExtension'))
class BulkPriceAdExtension(_BulkAdExtensionBase):
""" Represents a Price Ad Extension.
This class exposes the :attr:`price_ad_extension` property that can be read and written
as fields of the Price Ad Extension record in a bulk file.
For more information, see Price Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V12
from bingads.v12.bulk.entities import QualityScoreData, PerformanceData
from bingads.v12.internal.bulk.string_table import _StringTable
from bingads.v12.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v12.internal.bulk.mappings import _SimpleBulkMapping, _ComplexBulkMapping
from bingads.v12.internal.extensions import *
_ShoppingSetting = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('ShoppingSetting'))
_DsaSetting = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('DynamicSearchAdsSetting'))
class BulkCampaign(_SingleRecordBulkEntity):
""" Represents a campaign that can be read or written in a bulk file.
This class exposes the :attr:`campaign` property that can be read and written as fields of the
Campaign record in a bulk file.
For more information, see Campaign at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
from bingads.v12.bulk.entities.common import PerformanceData
from bingads.v12.internal.bulk.entities.bulk_entity_identifier import _BulkEntityIdentifier
from bingads.v12.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v12.internal.bulk.string_table import _StringTable
from bingads.v12.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v12.internal.extensions import *
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V12
Date = _CAMPAIGN_OBJECT_FACTORY_V12.create('Date')
class _BulkAdExtensionBase(_SingleRecordBulkEntity):
""" This class provides properties that are shared by all bulk ad extension classes.
*See also:*
* :class:`.BulkCallAdExtension`
* :class:`.BulkImageAdExtension`
* :class:`.BulkLocationAdExtension`
* :class:`.BulkSiteLinkAdExtension`
"""
def __init__(self, account_id=None, ad_extension=None):
super(_BulkAdExtensionBase, self).__init__()
self._account_id = account_id
def process_mappings_from_row_values(self, row_values):
self._biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('BiddableAdGroupCriterion')
self._biddable_ad_group_criterion.Type = 'BiddableAdGroupCriterion'
self._biddable_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('RadiusCriterion')
self._biddable_ad_group_criterion.Criterion.Type = 'RadiusCriterion'
self._biddable_ad_group_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY_V12.create('BidMultiplier')
self._biddable_ad_group_criterion.CriterionBid.Type = 'BidMultiplier'
row_values.convert_to_entity(self, BulkAdGroupRadiusCriterion._MAPPINGS)
def process_mappings_from_row_values(self, row_values):
self._keyword = _CAMPAIGN_OBJECT_FACTORY_V12.create('Keyword')
row_values.convert_to_entity(self, BulkKeyword._MAPPINGS)
self._quality_score_data = QualityScoreData.read_from_row_values_or_null(row_values)
self._performance_data = PerformanceData.read_from_row_values_or_null(row_values)
from bingads.v12.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v12.internal.bulk.string_table import _StringTable
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V12
from .common import _BulkAdExtensionBase
from .common import _BulkAdGroupAdExtensionAssociation
from .common import _BulkCampaignAdExtensionAssociation
from .common import _BulkAccountAdExtensionAssociation
from bingads.v12.internal.extensions import *
_AppAdExtension = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('AppAdExtension'))
class BulkAppAdExtension(_BulkAdExtensionBase):
""" Represents a app ad extension.
This class exposes the :attr:`app_ad_extension` property that can be read and written
as fields of the App Ad Extension record in a bulk file.
For more information, see App Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
def process_mappings_from_row_values(self, row_values):
self._custom_audience = _CAMPAIGN_OBJECT_FACTORY_V12.create('CustomAudience')
row_values.convert_to_entity(self, BulkCustomAudience._MAPPINGS)
from bingads.v12.bulk.entities import *
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V12
from bingads.v12.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v12.internal.bulk.mappings import _SimpleBulkMapping, _ComplexBulkMapping
from bingads.v12.internal.bulk.string_table import _StringTable
from bingads.v12.bulk.entities.common import PerformanceData
# from bingads.v12.internal.extensions import bulk_str
from bingads.v12.internal.extensions import *
_BiddableAdGroupCriterion = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('BiddableAdGroupCriterion'))
_NegativeAdGroupCriterion = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('NegativeAdGroupCriterion'))
_FixedBid = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('FixedBid'))
def csv_to_bidding(row_values, entity):
success, exclude = row_values.try_get_value(_StringTable.IsExcluded)
if exclude is None:
exclude = ''
exclude = exclude.lower()
if exclude == 'yes' or exclude == 'true':
is_excluded = True
elif exclude == 'no' or exclude == 'false':
is_excluded = False
else:
raise ValueError('IsExcluded can only be set to TRUE|FALSE in Ad Group Product Partition row')
if is_excluded:
product_partition = _CAMPAIGN_OBJECT_FACTORY_V12.create('ProductPartition')