コード例 #1
0
    def process_mappings_from_row_values(self, row_values):
        self._negative_campaign_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('NegativeCampaignCriterion')
        self._negative_campaign_criterion.Type = 'NegativeCampaignCriterion'
        self._negative_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('Webpage')
        self._negative_campaign_criterion.Criterion.Type = 'Webpage'

        row_values.convert_to_entity(self, BulkCampaignNegativeDynamicSearchAdTarget._MAPPINGS)
コード例 #2
0
 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('LocationCriterion')
     self._biddable_ad_group_criterion.Criterion.Type = 'LocationCriterion'
     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, BulkAdGroupLocationCriterion._MAPPINGS)
コード例 #3
0
 def process_mappings_from_row_values(self, row_values):
     self._biddable_campaign_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('BiddableCampaignCriterion')
     self._biddable_campaign_criterion.Type = 'BiddableCampaignCriterion'
     self._biddable_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('DeviceCriterion')
     self._biddable_campaign_criterion.Criterion.Type = 'DeviceCriterion'
     self._biddable_campaign_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY_V12.create('BidMultiplier')
     self._biddable_campaign_criterion.CriterionBid.Type = 'BidMultiplier'
     row_values.convert_to_entity(self, BulkCampaignDeviceCriterion._MAPPINGS)
コード例 #4
0
    def process_mappings_from_row_values(self, row_values):
        self._biddable_campaign_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create(
            'BiddableCampaignCriterion')
        self._biddable_campaign_criterion.Type = 'BiddableCampaignCriterion'
        self._biddable_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create(
            'ProductScope')
        self._biddable_campaign_criterion.Criterion.Type = 'ProductScope'

        row_values.convert_to_entity(self, BulkCampaignProductScope._MAPPINGS)
 def process_mappings_from_row_values(self, row_values):
     self._negative_campaign_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'NegativeCampaignCriterion')
     self._negative_campaign_criterion.Type = 'NegativeCampaignCriterion'
     self._negative_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'AudienceCriterion')
     self._negative_campaign_criterion.Criterion.Type = 'AudienceCriterion'
     row_values.convert_to_entity(
         self, BulkCampaignNegativeAudienceAssociation._MAPPINGS)
コード例 #6
0
 def process_mappings_from_row_values(self, row_values):
     self._negative_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'NegativeAdGroupCriterion')
     self._negative_ad_group_criterion.Type = 'NegativeAdGroupCriterion'
     self._negative_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'LocationCriterion')
     self._negative_ad_group_criterion.Criterion.Type = 'LocationCriterion'
     row_values.convert_to_entity(
         self, BulkAdGroupNegativeLocationCriterion._MAPPINGS)
コード例 #7
0
 def _read_campaign_type(c, v):
     if not v:
         return []
     campaign_type = v
     c.campaign.CampaignType = [campaign_type]
     if campaign_type.lower() == 'shopping' or campaign_type.lower() == 'audience':
         c.campaign.Settings = _CAMPAIGN_OBJECT_FACTORY_V12.create('ArrayOfSetting')
         shopping_setting = _CAMPAIGN_OBJECT_FACTORY_V12.create('ShoppingSetting')
         shopping_setting.Type = 'ShoppingSetting'
         c.campaign.Settings.Setting = [shopping_setting]
コード例 #8
0
    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('AudienceCriterion')
        self._biddable_ad_group_criterion.Criterion.Type = 'AudienceCriterion'
        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, BulkAdGroupProductAudienceAssociation._MAPPINGS)

        self._performance_data = PerformanceData.read_from_row_values_or_null(row_values)
コード例 #9
0
 def process_mappings_from_row_values(self, row_values):
     self._negative_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'NegativeAdGroupCriterion')
     self._negative_ad_group_criterion.Type = 'NegativeAdGroupCriterion'
     self._negative_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'AudienceCriterion')
     self._negative_ad_group_criterion.Criterion.Type = 'AudienceCriterion'
     row_values.convert_to_entity(
         self,
         BulkAdGroupNegativeSimilarRemarketingListAssociation._MAPPINGS)
コード例 #10
0
 def process_mappings_from_row_values(self, row_values):
     self.location_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'LocationAdExtension')
     self.location_ad_extension.Type = 'LocationAdExtension'
     if row_values[_StringTable.Latitude] or row_values[
             _StringTable.Longitude]:
         self.location_ad_extension.GeoPoint = _CAMPAIGN_OBJECT_FACTORY_V12.create(
             'GeoPoint')
     super(BulkLocationAdExtension,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkLocationAdExtension._MAPPINGS)
コード例 #11
0
 def set_geo_point_part(bulk_ad_extension, set_func, value):
     if not value:
         return
     if bulk_ad_extension.location_ad_extension.GeoPoint is None:
         bulk_ad_extension.location_ad_extension.GeoPoint = _CAMPAIGN_OBJECT_FACTORY_V12.create(
             'GeoPoint')
     set_func(bulk_ad_extension.location_ad_extension.GeoPoint, value)
コード例 #12
0
 def process_mappings_from_row_values(self, row_values):
     self._ad_extension_id_to_entity_id_association = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'AdExtensionIdToEntityIdAssociation')
     row_values.convert_to_entity(self,
                                  _BulkAdExtensionAssociation._MAPPINGS)
     self._performance_data = PerformanceData.read_from_row_values_or_null(
         row_values)
コード例 #13
0
 def process_mappings_from_row_values(self, row_values):
     self._shared_entity_association = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'SharedEntityAssociation')
     self._shared_entity_association.EntityType = 'Campaign'
     self._shared_entity_association.SharedEntityType = 'NegativeKeywordList'
     row_values.convert_to_entity(self,
                                  BulkCampaignNegativeKeywordList._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)
コード例 #15
0
 def process_mappings_from_row_values(self, row_values):
     self.app_install_ad = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'AppInstallAd')
     self.app_install_ad.Type = 'AppInstall'
     super(BulkAppInstallAd,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkAppInstallAd._MAPPINGS)
コード例 #16
0
 def process_mappings_from_row_values(self, row_values):
     self.image_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'ImageAdExtension')
     self.image_ad_extension.Type = 'ImageAdExtension'
     super(BulkImageAdExtension,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkImageAdExtension._MAPPINGS)
コード例 #17
0
    def process_mappings_from_row_values(self, row_values):
        self.ad_group = _CAMPAIGN_OBJECT_FACTORY_V12.create('AdGroup')

        row_values.convert_to_entity(self, BulkAdGroup._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)
コード例 #18
0
 def process_mappings_from_row_values(self, row_values):
     self.responsive_search_ad = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'ResponsiveSearchAd')
     self.responsive_search_ad.Type = 'ResponsiveSearch'
     super(BulkResponsiveSearchAd,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkResponsiveSearchAd._MAPPINGS)
コード例 #19
0
 def process_mappings_from_row_values(self, row_values):
     self.expanded_text_ad = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'ExpandedTextAd')
     self.expanded_text_ad.Type = 'ExpandedText'
     super(BulkExpandedTextAd,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkExpandedTextAd._MAPPINGS)
 def process_mappings_from_row_values(self, row_values):
     self.structured_snippet_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'StructuredSnippetAdExtension')
     self.structured_snippet_ad_extension.Type = 'StructuredSnippetAdExtension'
     super(BulkStructuredSnippetAdExtension,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(
         self, BulkStructuredSnippetAdExtension._MAPPINGS)
コード例 #21
0
    def _read_is_excluded(cls, entity, row_value):
        if row_value is None:
            row_value = ''
        row_value = row_value.lower()
        if row_value == 'yes' or row_value == 'true':
            is_excluded = True
        elif row_value == 'no' or row_value == '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')
            product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V12.create('ProductCondition')
            product_partition.Type = 'ProductPartition'

            negative_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('NegativeAdGroupCriterion')
            negative_ad_group_criterion.Criterion = product_partition
            negative_ad_group_criterion.Type = 'NegativeAdGroupCriterion'

            entity.ad_group_criterion = negative_ad_group_criterion
        else:
            product_partition = _CAMPAIGN_OBJECT_FACTORY_V12.create('ProductPartition')
            product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V12.create('ProductCondition')
            product_partition.Type = 'ProductPartition'

            fixed_bid = _CAMPAIGN_OBJECT_FACTORY_V12.create('FixedBid')
            fixed_bid.Type = 'FixedBid'

            biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('BiddableAdGroupCriterion')
            biddable_ad_group_criterion.Criterion = product_partition
            biddable_ad_group_criterion.CriterionBid = fixed_bid
            biddable_ad_group_criterion.Type = 'BiddableAdGroupCriterion'

            entity.ad_group_criterion = biddable_ad_group_criterion
コード例 #22
0
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')
        product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V12.create(
            'ProductCondition')
        product_partition.Type = 'ProductPartition'

        negative_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create(
            'NegativeAdGroupCriterion')
        negative_ad_group_criterion.Criterion = product_partition
        negative_ad_group_criterion.Type = 'NegativeAdGroupCriterion'

        entity.ad_group_criterion = negative_ad_group_criterion
    else:
        product_partition = _CAMPAIGN_OBJECT_FACTORY_V12.create(
            'ProductPartition')
        product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V12.create(
            'ProductCondition')
        product_partition.Type = 'ProductPartition'

        bid = _CAMPAIGN_OBJECT_FACTORY_V12.create('FixedBid')
        bid.Type = 'FixedBid'

        biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create(
            'BiddableAdGroupCriterion')
        biddable_ad_group_criterion.Criterion = product_partition

        success, bid_value = row_values.try_get_value(_StringTable.Bid)
        if success and bid_value is not None and bid_value != '':
            bid.Amount = float(bid_value)
        else:
            success, bid_value = row_values.try_get_value(
                _StringTable.BidAdjustment)
            if success and bid_value is not None and bid_value != '':
                bid = _CAMPAIGN_OBJECT_FACTORY_V12.create('BidMultiplier')
                bid.Type = 'BidMultiplier'
                bid.Multiplier = float(bid_value)

        biddable_ad_group_criterion.CriterionBid = bid
        biddable_ad_group_criterion.Type = 'BiddableAdGroupCriterion'

        entity.ad_group_criterion = biddable_ad_group_criterion
コード例 #23
0
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
コード例 #24
0
    def add_conditions_from_row_values(row_values, conditions):
        """

        :param row_values:
        :type row_values: _RowValues
        :param conditions:
        :type conditions: list[ProductCondition]
        :rtype: None
        """

        condition_header_prefix = _StringTable.ProductCondition1[:-1]
        value_header_prefix = _StringTable.ProductValue1[:-1]

        for i in range(1, _ProductConditionHelper.MAX_NUMBER_OF_CONDITIONS + 1):
            condition_success, product_condition = row_values.try_get_value(condition_header_prefix + str(i))
            value_success, product_value = row_values.try_get_value(value_header_prefix + str(i))

            if product_condition and product_value:
                condition = _CAMPAIGN_OBJECT_FACTORY_V12.create('ProductCondition')
                condition.Operand = product_condition
                condition.Attribute = product_value
                conditions.append(condition)
コード例 #25
0
 def process_mappings_from_row_values(self, row_values):
     self.experiment = _CAMPAIGN_OBJECT_FACTORY_V12.create('Experiment')
     row_values.convert_to_entity(self, BulkExperiment._MAPPINGS)
コード例 #26
0
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
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'))


class BulkAdGroupProductPartition(_SingleRecordBulkEntity):
    """ Represents an Ad Group Criterion that can be read or written in a bulk file.

    This class exposes the :attr:`ad_group_criterion` property that can be read and written as fields of the
    Ad Group Product Partition record in a bulk file.

    For more information, see Ad Group Product Scope at https://go.microsoft.com/fwlink/?linkid=846127.

    *See also:*

    * :class:`.BulkServiceManager`
    * :class:`.BulkOperation`
    * :class:`.BulkFileReader`
    * :class:`.BulkFileWriter`
    """

    def __init__(self,
                 ad_group_criterion=None,
コード例 #27
0
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 bingads.v12.internal.extensions import *
from .common import _BulkAdExtensionBase
from .common import _BulkCampaignAdExtensionAssociation
from .common import _BulkAdGroupAdExtensionAssociation
from .common import _BulkAccountAdExtensionAssociation

_ImageAdExtension = type(
    _CAMPAIGN_OBJECT_FACTORY_V12.create('ImageAdExtension'))


class BulkImageAdExtension(_BulkAdExtensionBase):
    """ Represents a image ad extension.

    This class exposes the :attr:`image_ad_extension` property that can be read and written
    as fields of the Image Ad Extension record in a bulk file.

    For more information, see Image 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, _ImageAdExtension):
コード例 #28
0
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 __init__(self, account_id=None, ad_extension=None):
        if ad_extension and not isinstance(ad_extension, _AppAdExtension):
コード例 #29
0
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 *

_SitelinkAdExtension = type(
    _CAMPAIGN_OBJECT_FACTORY_V12.create('SitelinkAdExtension'))


class BulkSitelinkAdExtension(_BulkAdExtensionBase):
    """ Represents a sitelink ad extension.

    This class exposes the :attr:`sitelink_ad_extension` property that can be read and written
    as fields of the Sitelink Ad Extension record in a bulk file.

    For more information, see Sitelink 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):
コード例 #30
0
 def process_mappings_from_row_values(self, row_values):
     self._remarketing_list = _CAMPAIGN_OBJECT_FACTORY_V12.create(
         'RemarketingList')
     row_values.convert_to_entity(self, BulkRemarketingList._MAPPINGS)