How to use the bingads.service_client._CAMPAIGN_OBJECT_FACTORY_V13.create function in bingads

To help you get started, we’ve selected a few bingads examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BingAds / BingAds-Python-SDK / bingads / v13 / internal / extensions.py View on Github external
def parse_rule_PageVisitorsWhoVisitedAnotherPage(rule_str):
    rule = _CAMPAIGN_OBJECT_FACTORY_V13.create('PageVisitorsWhoVisitedAnotherPageRule')
    rule.Type = 'PageVisitorsWhoVisitedAnotherPage'

    groups_split = '))) and ((('
    groups_string_list = rule_str.split(groups_split)

    rule.RuleItemGroups = parse_rule_groups(groups_string_list[0])
    rule.AnotherRuleItemGroups = parse_rule_groups(groups_string_list[1])

    return rule
github BingAds / BingAds-Python-SDK / bingads / v13 / internal / extensions.py View on Github external
def csv_to_field_BidStrategyType(entity, value):
    """
    set BiddingScheme
    :param entity: entity which has BiddingScheme attribute
    :param value: the content in csv
    :return:
    """
    if value is None or value == '':
        return
    elif value == 'EnhancedCpc':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V13.create('EnhancedCpcBiddingScheme')
    elif value == 'InheritFromParent':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V13.create('InheritFromParentBiddingScheme')
    elif value == 'MaxConversions':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V13.create('MaxConversionsBiddingScheme')
    elif value == 'ManualCpc':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V13.create('ManualCpcBiddingScheme')
    elif value == 'TargetCpa':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V13.create('TargetCpaBiddingScheme')
    elif value == 'MaxClicks':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V13.create('MaxClicksBiddingScheme')
    elif value == 'TargetRoas':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V13.create('TargetRoasBiddingScheme')
    elif value == 'MaxConversionValue':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V13.create('MaxConversionValueBiddingScheme')
    elif value == 'TargetImpressionShare':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V13.create('TargetImpressionShareBiddingScheme')
    else:
        raise ValueError('Unknown Bid Strategy Type')
github BingAds / BingAds-Python-SDK / bingads / v13 / bulk / entities / bulk_ads.py View on Github external
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)
github BingAds / BingAds-Python-SDK / bingads / v13 / bulk / entities / ad_extensions / bulk_price_ad_extensions.py View on Github external
def process_mappings_from_row_values(self, row_values):
        self.price_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V13.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)
github BingAds / BingAds-Python-SDK / bingads / v13 / internal / extensions.py View on Github external
return 'EnhancedCpc'
    elif type(entity.BiddingScheme) == type(_CAMPAIGN_OBJECT_FACTORY_V13.create('InheritFromParentBiddingScheme')):
        return 'InheritFromParent'
    elif type(entity.BiddingScheme) == type(_CAMPAIGN_OBJECT_FACTORY_V13.create('MaxConversionsBiddingScheme')):
        return 'MaxConversions'
    elif type(entity.BiddingScheme) == type(_CAMPAIGN_OBJECT_FACTORY_V13.create('ManualCpcBiddingScheme')):
        return 'ManualCpc'
    elif type(entity.BiddingScheme) == type(_CAMPAIGN_OBJECT_FACTORY_V13.create('TargetCpaBiddingScheme')):
        return 'TargetCpa'
    elif type(entity.BiddingScheme) == type(_CAMPAIGN_OBJECT_FACTORY_V13.create('MaxClicksBiddingScheme')):
        return 'MaxClicks'
    elif type(entity.BiddingScheme) == type(_CAMPAIGN_OBJECT_FACTORY_V13.create('MaxConversionValueBiddingScheme')):
        return 'MaxConversionValue'
    elif type(entity.BiddingScheme) == type(_CAMPAIGN_OBJECT_FACTORY_V13.create('TargetRoasBiddingScheme')):
        return 'TargetRoas'
    elif type(entity.BiddingScheme) == type(_CAMPAIGN_OBJECT_FACTORY_V13.create('TargetImpressionShare')):
        return 'TargetImpressionShare'
    else:
        raise TypeError('Unsupported Bid Strategy Type')
github BingAds / BingAds-Python-SDK / bingads / v13 / internal / extensions.py View on Github external
CustomEventsRule = _CAMPAIGN_OBJECT_FACTORY_V13.create('CustomEventsRule')
StringOperator = _CAMPAIGN_OBJECT_FACTORY_V13.create('StringOperator')
NumberOperator = _CAMPAIGN_OBJECT_FACTORY_V13.create('NumberOperator')

AudienceCriterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('AudienceCriterion')
BidMultiplier = _CAMPAIGN_OBJECT_FACTORY_V13.create('BidMultiplier')

AgeCriterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('AgeCriterion')
DayTimeCriterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('DayTimeCriterion')
DeviceCriterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('DeviceCriterion')
GenderCriterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('GenderCriterion')
LocationCriterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('LocationCriterion')
LocationIntentCriterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('LocationIntentCriterion')
RadiusCriterion = _CAMPAIGN_OBJECT_FACTORY_V13.create('RadiusCriterion')
TargetSetting_Type = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('TargetSetting'))
CoOpSetting_Type = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('CoOpSetting'))
TextAsset_Type = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('TextAsset'))
ImageAsset_Type = type(_CAMPAIGN_OBJECT_FACTORY_V13.create('ImageAsset'))

def bulk_str(value):
    if value is None or (hasattr(value, 'value') and value.value is None):
        return None
    if isinstance(value, str):
        return value
    if PY2:
        if isinstance(value, unicode):
            return value
    return str(value)


def bulk_upper_str(value):
    s = bulk_str(value)
github BingAds / BingAds-Python-SDK / bingads / v13 / bulk / entities / bulk_campaign.py View on Github external
    @staticmethod
    def _create_campaign_setting(campaign, setting_type):
        campaign.Settings = _CAMPAIGN_OBJECT_FACTORY_V13.create('ArrayOfSetting')
        setting = _CAMPAIGN_OBJECT_FACTORY_V13.create(setting_type)
        setting.Type = setting_type
        campaign.Settings.Setting = [setting]
github BingAds / BingAds-Python-SDK / bingads / v13 / internal / extensions.py View on Github external
_BULK_DATETIME_FORMAT_2 = '%m/%d/%Y %H:%M:%S.%f'
_BULK_DATE_FORMAT = "%m/%d/%Y"

url_splitter = ";\\s*(?=https?://)"
custom_param_splitter = "(?
github BingAds / BingAds-Python-SDK / bingads / v13 / bulk / entities / bulk_ad_group_product_partition.py View on Github external
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'
github BingAds / BingAds-Python-SDK / bingads / v13 / bulk / entities / ad_extensions / bulk_price_ad_extensions.py View on Github external
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping, _ComplexBulkMapping
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 *

_PriceAdExtension = type(_CAMPAIGN_OBJECT_FACTORY_V13.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`