def process_mappings_from_row_values(self, row_values):
        self._negative_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('NegativeAdGroupCriterion')
        self._negative_ad_group_criterion.Type = 'NegativeAdGroupCriterion'
        self._negative_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('Webpage')
        self._negative_ad_group_criterion.Criterion.Type = 'Webpage'

        row_values.convert_to_entity(self, BulkAdGroupNegativeDynamicSearchAdTarget._MAPPINGS)
 def process_mappings_from_row_values(self, row_values):
     self._negative_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('NegativeAdGroupCriterion')
     self._negative_ad_group_criterion.Type = 'NegativeAdGroupCriterion'
     self._negative_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('ProfileCriterion')
     self._negative_ad_group_criterion.Criterion.Type = 'ProfileCriterion'
     self._negative_ad_group_criterion.Criterion.ProfileType = self.profile_type()
     row_values.convert_to_entity(self, BulkAdGroupNegativeProfileCriterion._MAPPINGS)
예제 #3
0
 def process_mappings_from_row_values(self, row_values):
     self._biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('BiddableAdGroupCriterion')
     self._biddable_ad_group_criterion.Type = 'BiddableAdGroupCriterion'
     self._biddable_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('DayTimeCriterion')
     self._biddable_ad_group_criterion.Criterion.Type = 'DayTimeCriterion'
     self._biddable_ad_group_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY_V13.create('BidMultiplier')
     self._biddable_ad_group_criterion.CriterionBid.Type = 'BidMultiplier'
     row_values.convert_to_entity(self, BulkAdGroupDayTimeCriterion._MAPPINGS)
 def process_mappings_from_row_values(self, row_values):
     self._biddable_campaign_criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('BiddableCampaignCriterion')
     self._biddable_campaign_criterion.Type = 'BiddableCampaignCriterion'
     self._biddable_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('GenderCriterion')
     self._biddable_campaign_criterion.Criterion.Type = 'GenderCriterion'
     self._biddable_campaign_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY_V13.create('BidMultiplier')
     self._biddable_campaign_criterion.CriterionBid.Type = 'BidMultiplier'
     row_values.convert_to_entity(self, BulkCampaignGenderCriterion._MAPPINGS)
예제 #5
0
    def process_mappings_from_row_values(self, row_values):
        self._biddable_campaign_criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create(
            'BiddableCampaignCriterion')
        self._biddable_campaign_criterion.Type = 'BiddableCampaignCriterion'
        self._biddable_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V13.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_V13.create(
         'NegativeCampaignCriterion')
     self._negative_campaign_criterion.Type = 'NegativeCampaignCriterion'
     self._negative_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create(
         'LocationCriterion')
     self._negative_campaign_criterion.Criterion.Type = 'LocationCriterion'
     row_values.convert_to_entity(
         self, BulkCampaignNegativeLocationCriterion._MAPPINGS)
예제 #7
0
    def process_mappings_from_row_values(self, row_values):
        self._biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('BiddableAdGroupCriterion')
        self._biddable_ad_group_criterion.Type = 'BiddableAdGroupCriterion'
        self._biddable_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('Webpage')
        self._biddable_ad_group_criterion.Criterion.Type = 'Webpage'
        self._biddable_ad_group_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY_V13.create('FixedBid')
        self._biddable_ad_group_criterion.CriterionBid.Type = 'FixedBid'

        row_values.convert_to_entity(self, BulkAdGroupDynamicSearchAdTarget._MAPPINGS)
 def process_mappings_from_row_values(self, row_values):
     self.location_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V13.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_V13.create(
             'GeoPoint')
     super(BulkLocationAdExtension,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkLocationAdExtension._MAPPINGS)
예제 #9
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_V13.create(
                    'ProductCondition')
                condition.Operand = product_condition
                condition.Attribute = product_value
                conditions.append(condition)
예제 #10
0
    def process_mappings_from_row_values(self, row_values):
        self.ad_group = _CAMPAIGN_OBJECT_FACTORY_V13.create('AdGroup')

        row_values.convert_to_entity(self, BulkAdGroup._MAPPINGS)

        self._quality_score_data = QualityScoreData.read_from_row_values_or_null(
            row_values)
 def process_mappings_from_row_values(self, row_values):
     self.call_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V13.create(
         'CallAdExtension')
     self.call_ad_extension.Type = 'CallAdExtension'
     super(BulkCallAdExtension,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkCallAdExtension._MAPPINGS)
 def process_mappings_from_row_values(self, row_values):
     self._shared_entity_association = _CAMPAIGN_OBJECT_FACTORY_V13.create(
         'SharedEntityAssociation')
     self._shared_entity_association.EntityType = 'Campaign'
     self._shared_entity_association.SharedEntityType = 'NegativeKeywordList'
     row_values.convert_to_entity(self,
                                  BulkCampaignNegativeKeywordList._MAPPINGS)
예제 #13
0
 def process_mappings_from_row_values(self, row_values):
     self.responsive_search_ad = _CAMPAIGN_OBJECT_FACTORY_V13.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)
예제 #14
0
 def process_mappings_from_row_values(self, row_values):
     self.expanded_text_ad = _CAMPAIGN_OBJECT_FACTORY_V13.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)
예제 #15
0
 def process_mappings_from_row_values(self, row_values):
     self.app_install_ad = _CAMPAIGN_OBJECT_FACTORY_V13.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)
 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_V13.create(
             'GeoPoint')
     set_func(bulk_ad_extension.location_ad_extension.GeoPoint, value)
 def process_mappings_from_row_values(self, row_values):
     self.similar_remarketing_list = _CAMPAIGN_OBJECT_FACTORY_V13.create(
         'SimilarRemarketingList')
     super(BulkSimilarRemarketingList,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self,
                                  BulkSimilarRemarketingList._MAPPINGS)
 def process_mappings_from_row_values(self, row_values):
     self.structured_snippet_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V13.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)
예제 #19
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_V13.create(
            'ProductPartition')
        product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V13.create(
            'ProductCondition')
        product_partition.Type = 'ProductPartition'

        negative_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V13.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_V13.create(
            'ProductPartition')
        product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V13.create(
            'ProductCondition')
        product_partition.Type = 'ProductPartition'

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

        biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V13.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_V13.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
예제 #20
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_V13.create('ProductPartition')
            product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V13.create('ProductCondition')
            product_partition.Type = 'ProductPartition'

            negative_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V13.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_V13.create('ProductPartition')
            product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V13.create('ProductCondition')
            product_partition.Type = 'ProductPartition'

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

            biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V13.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
예제 #21
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_V13.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
예제 #22
0
 def process_mappings_from_row_values(self, row_values):
     self._label_association = _CAMPAIGN_OBJECT_FACTORY_V13.create(
         'LabelAssociation')
     row_values.convert_to_entity(self, _BulkLabelAssociation._MAPPINGS)
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 .common import *
from .common import _BulkAdExtensionBase
from .common import _BulkCampaignAdExtensionAssociation
from .common import _BulkAccountAdExtensionAssociation

_LocationAdExtension = type(
    _CAMPAIGN_OBJECT_FACTORY_V13.create('LocationAdExtension'))


class BulkLocationAdExtension(_BulkAdExtensionBase):
    """ Represents an location ad extension.

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

    For more information, see Location 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, _LocationAdExtension):
            raise ValueError(
예제 #24
0
 def process_mappings_from_row_values(self, row_values):
     self._remarketing_list = _CAMPAIGN_OBJECT_FACTORY_V13.create(
         'RemarketingList')
     row_values.convert_to_entity(self, BulkRemarketingList._MAPPINGS)
예제 #25
0
from bingads.v13.bulk.entities import *
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13
from bingads.v13.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v13.internal.bulk.string_table import _StringTable
# from bingads.v13.internal.extensions import bulk_str
from bingads.v13.internal.extensions import *

_BiddableAdGroupCriterion = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('BiddableAdGroupCriterion'))
_NegativeAdGroupCriterion = type(_CAMPAIGN_OBJECT_FACTORY_V13.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,
                 campaign_name=None,
 def set_data_from_identifier(self, identifier):
     self._campaign_negative_sites = _CAMPAIGN_OBJECT_FACTORY_V13.create(
         'CampaignNegativeSites')
     self.campaign_negative_sites.CampaignId = identifier.campaign_id
     self._campaign_name = identifier.campaign_name
 def set_data_from_identifier(self, identifier):
     self._ad_group_negative_sites = _CAMPAIGN_OBJECT_FACTORY_V13.create(
         'AdGroupNegativeSites')
     self._ad_group_negative_sites.AdGroupId = identifier.ad_group_id
     self._ad_group_name = identifier.ad_group_name
     self._campaign_name = identifier.campaign_name
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 .common import _BulkAdExtensionBase
from .common import _BulkAdGroupAdExtensionAssociation
from .common import _BulkCampaignAdExtensionAssociation
from .common import _BulkAccountAdExtensionAssociation

from bingads.v13.internal.extensions import *


_PromotionAdExtension = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('PromotionAdExtension'))


class BulkPromotionAdExtension(_BulkAdExtensionBase):
    """ Represents a promotion ad extension.

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

    For more information, see Promotion 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_V13
from bingads.v13.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping, _ComplexBulkMapping
from bingads.v13.internal.bulk.string_table import _StringTable
from bingads.v13.internal.extensions import *

_BiddableAdGroupCriterion = type(
    _CAMPAIGN_OBJECT_FACTORY_V13.create('BiddableAdGroupCriterion'))


class BulkAdGroupDynamicSearchAdTarget(_SingleRecordBulkEntity):
    """ Represents a Ad Group 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 Dynamic Search Ad Target record in a bulk file.

    For more information, see Ad Group Dynamic Search Ad Target at https://go.microsoft.com/fwlink/?linkid=836837.

    *See also:*

    * :class:`.BulkServiceManager`
    * :class:`.BulkOperation`
    * :class:`.BulkFileReader`
    * :class:`.BulkFileWriter`
    """
    def __init__(self,
                 campaign_name=None,
                 ad_group_name=None,
                 status=None,
                 biddable_ad_group_criterion=None):
        super(BulkAdGroupDynamicSearchAdTarget, self).__init__()
 def set_address_part(bulk_ad_extension, set_func):
     if bulk_ad_extension.location_ad_extension.Address is None:
         bulk_ad_extension.location_ad_extension.Address = _CAMPAIGN_OBJECT_FACTORY_V13.create(
             'Address')
     set_func(bulk_ad_extension.location_ad_extension.Address)