def process_mappings_from_row_values(self, row_values):
     self.location_ad_extension = _CAMPAIGN_OBJECT_FACTORY.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.create('GeoPoint')
     super(BulkLocationAdExtension, self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkLocationAdExtension._MAPPINGS)
    def process_mappings_from_row_values(self, row_values):
        self._campaign_criterion = _CAMPAIGN_OBJECT_FACTORY.create('CampaignCriterion')
        self._campaign_criterion.Type = 'CampaignCriterion'
        self._campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY.create('ProductScope')
        self._campaign_criterion.Criterion.Type = 'ProductScope'

        row_values.convert_to_entity(self, BulkCampaignProductScope._MAPPINGS)
Beispiel #3
0
    def process_mappings_from_row_values(self, row_values):
        self._campaign_criterion = _CAMPAIGN_OBJECT_FACTORY.create(
            'CampaignCriterion')
        self._campaign_criterion.Type = 'CampaignCriterion'
        self._campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY.create(
            'ProductScope')
        self._campaign_criterion.Criterion.Type = 'ProductScope'

        row_values.convert_to_entity(self, BulkCampaignProductScope._MAPPINGS)
    def process_mappings_from_row_values(self, row_values):
        self.biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY.create('BiddableAdGroupCriterion')
        self.biddable_ad_group_criterion.Type = 'BiddableAdGroupCriterion'
        self.biddable_ad_group_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY.create('FixedBid')
        self.biddable_ad_group_criterion.CriterionBid.Type = 'FixedBid'
        self.biddable_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY.create('Product')
        self.biddable_ad_group_criterion.Criterion.Type = 'Product'

        row_values.convert_to_entity(self, BulkAdGroupProductTarget._MAPPINGS)
 def _read_campaign_type(c, v):
     if not v:
         return []
     campaign_type = v
     c.campaign.CampaignType = [campaign_type]
     if campaign_type.lower() == 'shopping':
         c.campaign.Settings = _CAMPAIGN_OBJECT_FACTORY.create('ArrayOfSetting')
         shopping_setting = _CAMPAIGN_OBJECT_FACTORY.create('ShoppingSetting')
         shopping_setting.Type = 'ShoppingSetting'
         c.campaign.Settings.Setting = [shopping_setting]
Beispiel #6
0
 def process_mappings_from_row_values(self, row_values):
     self.location_ad_extension = _CAMPAIGN_OBJECT_FACTORY.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.create(
             'GeoPoint')
     super(BulkLocationAdExtension,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkLocationAdExtension._MAPPINGS)
Beispiel #7
0
    def process_mappings_from_row_values(self, row_values):
        self.biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY.create(
            'BiddableAdGroupCriterion')
        self.biddable_ad_group_criterion.Type = 'BiddableAdGroupCriterion'
        self.biddable_ad_group_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY.create(
            'FixedBid')
        self.biddable_ad_group_criterion.CriterionBid.Type = 'FixedBid'
        self.biddable_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY.create(
            'Product')
        self.biddable_ad_group_criterion.Criterion.Type = 'Product'

        row_values.convert_to_entity(self, BulkAdGroupProductTarget._MAPPINGS)
 def _read_campaign_type(c, v):
     if not v:
         return []
     campaign_type = v
     c.campaign.CampaignType = [campaign_type]
     if campaign_type.lower() == 'shopping':
         c.campaign.Settings = _CAMPAIGN_OBJECT_FACTORY.create(
             'ArrayOfSetting')
         shopping_setting = _CAMPAIGN_OBJECT_FACTORY.create(
             'ShoppingSetting')
         shopping_setting.Type = 'ShoppingSetting'
         c.campaign.Settings.Setting = [shopping_setting]
 def process_mappings_from_row_values(self, row_values):
     self._shared_entity_association = _CAMPAIGN_OBJECT_FACTORY.create(
         'SharedEntityAssociation')
     self._shared_entity_association.EntityType = 'Campaign'
     self._shared_entity_association.SharedEntityType = 'NegativeKeywordList'
     row_values.convert_to_entity(self,
                                  BulkCampaignNegativeKeywordList._MAPPINGS)
Beispiel #10
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.create(
             'GeoPoint')
     set_func(bulk_ad_extension.location_ad_extension.GeoPoint, value)
Beispiel #11
0
 def process_mappings_from_row_values(self, row_values):
     self._ad_extension_id_to_entity_id_association = _CAMPAIGN_OBJECT_FACTORY.create(
         'AdExtensionIdToEntityIdAssociation')
     row_values.convert_to_entity(self,
                                  _BulkAdExtensionAssociation._MAPPINGS)
     self._performance_data = PerformanceData.read_from_row_values_or_null(
         row_values)
 def process_mappings_from_row_values(self, row_values):
     self._keyword = _CAMPAIGN_OBJECT_FACTORY.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)
Beispiel #13
0
def parse_keyword_bid(value):
    bid = _CAMPAIGN_OBJECT_FACTORY.create('Bid')
    if not value:
        bid.Amount = None
    else:
        bid.Amount = float(value)
    return bid
Beispiel #14
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.create('ProductCondition')
                condition.Operand = product_condition
                condition.Attribute = product_value
                conditions.append(condition)
 def process_mappings_from_row_values(self, row_values):
     self.app_ad_extension = _CAMPAIGN_OBJECT_FACTORY.create(
         'AppAdExtension')
     self.app_ad_extension.Type = 'AppAdExtension'
     super(BulkAppAdExtension,
           self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkAppAdExtension._MAPPINGS)
    def process_mappings_from_row_values(self, row_values):
        self.ad_group = _CAMPAIGN_OBJECT_FACTORY.create('AdGroup')
        self.ad_group.AdDistribution = ''

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

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

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

            biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY.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
Beispiel #18
0
def parse_date(d_str):
    if not d_str:
        return None
    parsed_date = datetime.strptime(d_str, _BULK_DATE_FORMAT)
    bing_ads_date = _CAMPAIGN_OBJECT_FACTORY.create('Date')
    bing_ads_date.Day = parsed_date.day
    bing_ads_date.Month = parsed_date.month
    bing_ads_date.Year = parsed_date.year

    return bing_ads_date
    def __init__(
        self,
        account_id=None,
        site_links_ad_extension=None,
        bulk_site_link=None,
        identifier=None,
    ):
        super(BulkSiteLinkAdExtension, self).__init__()

        self._account_id = account_id
        self._site_links_ad_extension = site_links_ad_extension
        self._bulk_site_links = []
        self._bulk_site_link = bulk_site_link
        self._identifier = identifier

        if self._bulk_site_link and self._identifier:
            raise ValueError(
                'Conflicting arguments of bulk site link and site link identifier provided.'
            )

        if self._bulk_site_link:
            if not isinstance(self._bulk_site_link, BulkSiteLink):
                raise ValueError(
                    'Site link object provided is not of type: {0}.'.format(
                        BulkSiteLink.__name__))
            self._identifier = self._bulk_site_link._identifier

        if self._identifier:
            if not isinstance(self._identifier,
                              _SiteLinkAdExtensionIdentifier):
                raise ValueError(
                    'Site link identifier object provided is not of type: {0}.'
                    .format(_SiteLinkAdExtensionIdentifier.__name__))
            self._has_delete_all_row = self._identifier.is_delete_row

            self._site_links_ad_extension = _CAMPAIGN_OBJECT_FACTORY.create(
                'SiteLinksAdExtension')
            self._site_links_ad_extension.Type = 'SiteLinksAdExtension'
            self._site_links_ad_extension.Id = self._identifier.ad_extension_id
            self._site_links_ad_extension.Status = self._identifier.status
            self._site_links_ad_extension.Version = self._identifier.version

            self.account_id = self._identifier.account_id
        if self._bulk_site_link:
            self._bulk_site_links.append(self._bulk_site_link)
    def __init__(self,
                 account_id=None,
                 product_ad_extension=None,
                 product_collection=None,
                 identifier=None):
        super(BulkProductAdExtension, self).__init__()
        self._account_id = account_id
        self._product_ad_extension = product_ad_extension
        self._product_condition_collections = []
        self._product_collection = product_collection
        self._identifier = identifier

        if self._product_collection and self._identifier:
            raise ValueError(
                'Conflicting arguments of product_collection and identifier provided.'
            )
        if self._product_collection:
            if not isinstance(self._product_collection,
                              BulkProductConditionCollection):
                raise ValueError(
                    'Product collection object provided is not of type: {0}.'.
                    format(BulkProductConditionCollection.__name__))
            self._identifier = self._product_collection._identifier
        if self._identifier:
            if not isinstance(self._identifier,
                              _BulkProductAdExtensionIdentifier):
                raise ValueError(
                    'Product ad extension identifier object provided is not of type: {0}'
                    .format(_BulkProductAdExtensionIdentifier.__name__))
            self._has_delete_all_row = self._identifier.is_delete_row

            self._product_ad_extension = _CAMPAIGN_OBJECT_FACTORY.create(
                'ProductAdExtension')
            self._product_ad_extension.Type = 'ProductAdExtension'
            self._product_ad_extension.Id = self._identifier.ad_extension_id
            self._product_ad_extension.Status = self._identifier.status
            self._product_ad_extension.Version = self._identifier.version
            self._product_ad_extension.Name = self._identifier.name

            self.account_id = self._identifier.account_id
        if self._product_collection:
            self._add_product_collection(self._product_collection)
    def __init__(self,
                 account_id=None,
                 product_ad_extension=None,
                 product_collection=None,
                 identifier=None):
        super(BulkProductAdExtension, self).__init__()
        self._account_id = account_id
        self._product_ad_extension = product_ad_extension
        self._product_condition_collections = []
        self._product_collection = product_collection
        self._identifier = identifier

        if self._product_collection and self._identifier:
            raise ValueError('Conflicting arguments of product_collection and identifier provided.')
        if self._product_collection:
            if not isinstance(self._product_collection, BulkProductConditionCollection):
                raise ValueError(
                    'Product collection object provided is not of type: {0}.'.format(
                        BulkProductConditionCollection.__name__
                    )
                )
            self._identifier = self._product_collection._identifier
        if self._identifier:
            if not isinstance(self._identifier, _BulkProductAdExtensionIdentifier):
                raise ValueError(
                    'Product ad extension identifier object provided is not of type: {0}'.format(
                        _BulkProductAdExtensionIdentifier.__name__
                    )
                )
            self._has_delete_all_row = self._identifier.is_delete_row

            self._product_ad_extension = _CAMPAIGN_OBJECT_FACTORY.create('ProductAdExtension')
            self._product_ad_extension.Type = 'ProductAdExtension'
            self._product_ad_extension.Id = self._identifier.ad_extension_id
            self._product_ad_extension.Status = self._identifier.status
            self._product_ad_extension.Version = self._identifier.version
            self._product_ad_extension.Name = self._identifier.name

            self.account_id = self._identifier.account_id
        if self._product_collection:
            self._add_product_collection(self._product_collection)
    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.create('ProductCondition')
                condition.Operand = product_condition
                condition.Attribute = product_value
                conditions.append(condition)
    def __init__(self,
                 account_id=None,
                 site_links_ad_extension=None,
                 bulk_site_link=None,
                 identifier=None,):
        super(BulkSiteLinkAdExtension, self).__init__()

        self._account_id = account_id
        self._site_links_ad_extension = site_links_ad_extension
        self._bulk_site_links = []
        self._bulk_site_link = bulk_site_link
        self._identifier = identifier

        if self._bulk_site_link and self._identifier:
            raise ValueError('Conflicting arguments of bulk site link and site link identifier provided.')

        if self._bulk_site_link:
            if not isinstance(self._bulk_site_link, BulkSiteLink):
                raise ValueError('Site link object provided is not of type: {0}.'.format(BulkSiteLink.__name__))
            self._identifier = self._bulk_site_link._identifier

        if self._identifier:
            if not isinstance(self._identifier, _SiteLinkAdExtensionIdentifier):
                raise ValueError(
                    'Site link identifier object provided is not of type: {0}.'.format(_SiteLinkAdExtensionIdentifier.__name__)
                )
            self._has_delete_all_row = self._identifier.is_delete_row

            self._site_links_ad_extension = _CAMPAIGN_OBJECT_FACTORY.create('SiteLinksAdExtension')
            self._site_links_ad_extension.Type = 'SiteLinksAdExtension'
            self._site_links_ad_extension.Id = self._identifier.ad_extension_id
            self._site_links_ad_extension.Status = self._identifier.status
            self._site_links_ad_extension.Version = self._identifier.version

            self.account_id = self._identifier.account_id
        if self._bulk_site_link:
            self._bulk_site_links.append(self._bulk_site_link)
Beispiel #24
0
 def process_mappings_from_row_values(self, row_values):
     self.text_ad = _CAMPAIGN_OBJECT_FACTORY.create('TextAd')
     self.text_ad.Type = 'Text'
     super(BulkTextAd, self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkTextAd._MAPPINGS)
 def process_mappings_from_row_values(self, row_values):
     self._negative_keyword = _CAMPAIGN_OBJECT_FACTORY.create('NegativeKeyword')
     self._negative_keyword.Type = 'NegativeKeyword'
     row_values.convert_to_entity(self, _BulkNegativeKeyword._MAPPINGS)
 def process_mappings_from_row_values(self, row_values):
     self._campaign = _CAMPAIGN_OBJECT_FACTORY.create('Campaign')
     row_values.convert_to_entity(self, BulkCampaign._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)
 def set_data_from_identifier(self, identifier):
     self._campaign_negative_sites = _CAMPAIGN_OBJECT_FACTORY.create('CampaignNegativeSites')
     self.campaign_negative_sites.CampaignId = identifier.campaign_id
     self._campaign_name = identifier.campaign_name
 def set_data_from_identifier(self, identifier):
     self._campaign_negative_sites = _CAMPAIGN_OBJECT_FACTORY.create(
         'CampaignNegativeSites')
     self.campaign_negative_sites.CampaignId = identifier.campaign_id
     self._campaign_name = identifier.campaign_name
 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.create('GeoPoint')
     set_func(bulk_ad_extension.location_ad_extension.GeoPoint, value)
Beispiel #30
0
def parse_ad_rotation(value):
    if not value:
        return None
    ad_rotation = _CAMPAIGN_OBJECT_FACTORY.create('AdRotation')
    ad_rotation.Type = None if value == DELETE_VALUE else value
    return ad_rotation
Beispiel #31
0
def parse_ad_group_bid(value):
    if not value:
        return None
    bid = _CAMPAIGN_OBJECT_FACTORY.create('Bid')
    bid.Amount = float(value)
    return bid
 def process_mappings_from_row_values(self, row_values):
     self._ad_extension_id_to_entity_id_association = _CAMPAIGN_OBJECT_FACTORY.create('AdExtensionIdToEntityIdAssociation')
     row_values.convert_to_entity(self, _BulkAdExtensionAssociation._MAPPINGS)
     self._performance_data = PerformanceData.read_from_row_values_or_null(row_values)
 def process_mappings_from_row_values(self, row_values):
     self._site_link = _CAMPAIGN_OBJECT_FACTORY.create('SiteLink')
     self._identifier.read_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkSiteLink._MAPPINGS)
Beispiel #34
0
from bingads.internal.bulk.mappings import _SimpleBulkMapping
from bingads.internal.bulk.string_table import _StringTable
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY

from .common import *
from .common import _BulkAdExtensionBase
from .common import _BulkAdExtensionAssociation

_CallAdExtension = type(_CAMPAIGN_OBJECT_FACTORY.create('CallAdExtension'))


class BulkCallAdExtension(_BulkAdExtensionBase):
    """ Represents a call ad extension.

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

    For more information, see Call Ad Extension at http://go.microsoft.com/fwlink/?LinkID=511514.

    *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, _CallAdExtension):
            raise ValueError(
                'The type of ad_extension is: {0}, should be: {1}'.format(
                    type(ad_extension), 'CallAdExtension'))
Beispiel #35
0
 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.create(
             'Address')
     set_func(bulk_ad_extension.location_ad_extension.Address)
from bingads.bulk.entities import PerformanceData
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY
from bingads.internal.bulk.string_table import _StringTable
from bingads.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.internal.bulk.mappings import _SimpleBulkMapping
from bingads.internal.extensions import *

# Define type used
MobileAd = type(_CAMPAIGN_OBJECT_FACTORY.create('MobileAd'))
ProductAd = type(_CAMPAIGN_OBJECT_FACTORY.create('ProductAd'))
TextAd = type(_CAMPAIGN_OBJECT_FACTORY.create('TextAd'))


class _BulkAd(_SingleRecordBulkEntity):
    """ This abstract base class provides properties that are shared by all bulk ad classes.

    *See also:*

    * :class:`.BulkMobileAd`
    * :class:`.BulkProductAd`
    * :class:`.BulkTextAd`
    """

    def __init__(self,
                 ad_group_id=None,
                 campaign_name=None,
                 ad_group_name=None,
                 ad=None):
        super(_BulkAd, self).__init__()

        self._ad_group_id = ad_group_id
 def process_mappings_from_row_values(self, row_values):
     self.product_condition_collection = _CAMPAIGN_OBJECT_FACTORY.create(
         'ProductConditionCollection')
     self._identifier.read_from_row_values(row_values)
     row_values.convert_to_entity(self,
                                  BulkProductConditionCollection._MAPPINGS)
from bingads.internal.extensions import bulk_optional_str
from bingads.internal.bulk.mappings import _SimpleBulkMapping
from bingads.internal.bulk.string_table import _StringTable
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY

from .common import *
from .common import _BulkAdExtensionBase
from .common import _BulkAdExtensionAssociation


_LocationAdExtension = type(_CAMPAIGN_OBJECT_FACTORY.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 http://go.microsoft.com/fwlink/?LinkID=511515.

    *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):
 def process_mappings_from_row_values(self, row_values):
     self.product_condition_collection = _CAMPAIGN_OBJECT_FACTORY.create('ProductConditionCollection')
     self._identifier.read_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkProductConditionCollection._MAPPINGS)
 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.create('Address')
     set_func(bulk_ad_extension.location_ad_extension.Address)
 def process_mappings_from_row_values(self, row_values):
     self._negative_keyword = _CAMPAIGN_OBJECT_FACTORY.create(
         'NegativeKeyword')
     self._negative_keyword.Type = 'NegativeKeyword'
     row_values.convert_to_entity(self, _BulkNegativeKeyword._MAPPINGS)
Beispiel #42
0
from bingads.bulk.entities import PerformanceData
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY
from bingads.internal.bulk.string_table import _StringTable
from bingads.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.internal.bulk.mappings import _SimpleBulkMapping
from bingads.internal.extensions import *

# Define type used
MobileAd = type(_CAMPAIGN_OBJECT_FACTORY.create('MobileAd'))
ProductAd = type(_CAMPAIGN_OBJECT_FACTORY.create('ProductAd'))
TextAd = type(_CAMPAIGN_OBJECT_FACTORY.create('TextAd'))


class _BulkAd(_SingleRecordBulkEntity):
    """ This abstract base class provides properties that are shared by all bulk ad classes.

    *See also:*

    * :class:`.BulkMobileAd`
    * :class:`.BulkProductAd`
    * :class:`.BulkTextAd`
    """
    def __init__(self,
                 ad_group_id=None,
                 campaign_name=None,
                 ad_group_name=None,
                 ad=None):
        super(_BulkAd, self).__init__()

        self._ad_group_id = ad_group_id
        self._campaign_name = campaign_name
from bingads.internal.bulk.mappings import _SimpleBulkMapping
from bingads.internal.bulk.string_table import _StringTable
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY

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

_AppAdExtension = type(_CAMPAIGN_OBJECT_FACTORY.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 http://go.microsoft.com/fwlink/?LinkID=515901.

    *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):
            raise ValueError(
                'The type of ad_extension is: {0}, should be: {1}'.format(
from bingads.internal.extensions import bulk_optional_str
from bingads.internal.bulk.mappings import _SimpleBulkMapping
from bingads.internal.bulk.string_table import _StringTable
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY

from .common import *
from .common import _BulkAdExtensionBase
from .common import _BulkCampaignAdExtensionAssociation
from .common import _BulkAdGroupAdExtensionAssociation

_ImageAdExtension = type(_CAMPAIGN_OBJECT_FACTORY.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 http://go.microsoft.com/fwlink/?LinkID=511909.

    *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):
            raise ValueError(
 def set_data_from_identifier(self, identifier):
     self._ad_group_negative_sites = _CAMPAIGN_OBJECT_FACTORY.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
 def set_data_from_identifier(self, identifier):
     self._ad_group_negative_sites = _CAMPAIGN_OBJECT_FACTORY.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.service_client import _CAMPAIGN_OBJECT_FACTORY
from bingads.bulk.entities import QualityScoreData, PerformanceData
from bingads.internal.bulk.string_table import _StringTable
from bingads.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.internal.bulk.mappings import _SimpleBulkMapping, _ComplexBulkMapping
from bingads.internal.extensions import bulk_str, csv_to_budget, budget_to_csv

_ShoppingSetting = type(_CAMPAIGN_OBJECT_FACTORY.create('ShoppingSetting'))


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 http://go.microsoft.com/fwlink/?LinkID=511521.

    *See also:*

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

    def __init__(self, account_id=None, campaign=None):
        super(BulkCampaign, self).__init__()

        self._account_id = account_id
        self._campaign = campaign
 def process_mappings_from_row_values(self, row_values):
     self._site_link = _CAMPAIGN_OBJECT_FACTORY.create('SiteLink')
     self._identifier.read_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkSiteLink._MAPPINGS)
 def process_mappings_from_row_values(self, row_values):
     self._shared_entity_association = _CAMPAIGN_OBJECT_FACTORY.create('SharedEntityAssociation')
     self._shared_entity_association.EntityType = 'Campaign'
     self._shared_entity_association.SharedEntityType = 'NegativeKeywordList'
     row_values.convert_to_entity(self, BulkCampaignNegativeKeywordList._MAPPINGS)
from bingads.internal.extensions import bulk_optional_str
from bingads.internal.bulk.mappings import _SimpleBulkMapping
from bingads.internal.bulk.string_table import _StringTable
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY

from .common import *
from .common import _BulkAdExtensionBase
from .common import _BulkAdExtensionAssociation


_ImageAdExtension = type(_CAMPAIGN_OBJECT_FACTORY.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 http://go.microsoft.com/fwlink/?LinkID=511909.

    *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):
from bingads.internal.bulk.mappings import _SimpleBulkMapping
from bingads.internal.bulk.string_table import _StringTable
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY

from .common import *
from .common import _BulkAdExtensionBase
from .common import _BulkCampaignAdExtensionAssociation

_CallAdExtension = type(_CAMPAIGN_OBJECT_FACTORY.create('CallAdExtension'))


class BulkCallAdExtension(_BulkAdExtensionBase):
    """ Represents a call ad extension.

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

    For more information, see Call Ad Extension at http://go.microsoft.com/fwlink/?LinkID=511514.

    *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, _CallAdExtension):
 def process_mappings_from_row_values(self, row_values):
     self.image_ad_extension = _CAMPAIGN_OBJECT_FACTORY.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)
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY
from bingads.bulk.entities import QualityScoreData, PerformanceData
from bingads.internal.bulk.string_table import _StringTable
from bingads.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.internal.bulk.mappings import _SimpleBulkMapping, _ComplexBulkMapping
from bingads.internal.extensions import bulk_str, csv_to_budget, budget_to_csv

_ShoppingSetting = type(_CAMPAIGN_OBJECT_FACTORY.create('ShoppingSetting'))


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 http://go.microsoft.com/fwlink/?LinkID=511521.

    *See also:*

    * :class:`.BulkServiceManager`
    * :class:`.BulkOperation`
    * :class:`.BulkFileReader`
    * :class:`.BulkFileWriter`
    """
    def __init__(self, account_id=None, campaign=None):
        super(BulkCampaign, self).__init__()

        self._account_id = account_id
        self._campaign = campaign
        self._quality_score_data = None
 def process_mappings_from_row_values(self, row_values):
     self.text_ad = _CAMPAIGN_OBJECT_FACTORY.create('TextAd')
     self.text_ad.Type = 'Text'
     super(BulkTextAd, self).process_mappings_from_row_values(row_values)
     row_values.convert_to_entity(self, BulkTextAd._MAPPINGS)
Beispiel #55
0
from bingads.internal.extensions import bulk_optional_str
from bingads.internal.bulk.mappings import _SimpleBulkMapping
from bingads.internal.bulk.string_table import _StringTable
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY

from .common import *
from .common import _BulkAdExtensionBase
from .common import _BulkCampaignAdExtensionAssociation

_LocationAdExtension = type(
    _CAMPAIGN_OBJECT_FACTORY.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 http://go.microsoft.com/fwlink/?LinkID=511515.

    *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(